Output different precision by column with pandas.DataFrame.to_csv()?

后端 未结 6 1704
深忆病人
深忆病人 2020-12-13 02:51

Question

Is it possible to specify a float precision specifically for each column to be printed by the Python pandas package method pandas.DataFrame.t

6条回答
  •  醉酒成梦
    2020-12-13 03:15

    You can do this with to_string. There is a formatters argument where you can provide a dict of columns names to formatters. Then you can use some regexp to replace the default column separators with your delimiter of choice.

提交回复
热议问题