为什么 pandas DataFrame.to_csv float_format 选项使用旧式格式?
Why is pandas DataFrame.to_csv float_format option using the old-style formatting?
我想将 pandas DataFrame 写入 CSV。我希望所有花车都有 2 个小数点。所以我使用了 new formatting style of Python:
indf.to_csv("myfile.csv", float_format="{:.2}")
但是不,显然 to_csv
想要 old formatting style
indf.to_csv("myfile.csv", float_format="%.2f")
这是为什么?
我想将 pandas DataFrame 写入 CSV。我希望所有花车都有 2 个小数点。所以我使用了 new formatting style of Python:
indf.to_csv("myfile.csv", float_format="{:.2}")
但是不,显然 to_csv
想要 old formatting style
indf.to_csv("myfile.csv", float_format="%.2f")
这是为什么?