Floating point precision affected when converting DataFrame to list

后端 未结 3 504
情歌与酒
情歌与酒 2021-01-25 08:57

So I\'m trying to convert a float DataFrame to a list (of list) by using row.values.tolist() (row was read from a CSV file). It does the job pretty oka

3条回答
  •  情歌与酒
    2021-01-25 09:51

    As Padraic alluded, you are not modifying the correct option with display.precision. Instead, try:

    pd.options.display.float_format = '{:,.3f}'.format
    

提交回复
热议问题