-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Closed
Labels
Description
Pandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html
Documentation problem
The float_format parameter in to_csv is explained but lacks examples. Users might struggle to understand how to apply this parameter effectively without concrete examples in the documentation.
Suggested fix for documentation
I suggest adding examples for float_format to make the documentation more beginner-friendly. Examples could include:
# Format floats to two decimal places
df.to_csv("example1.csv", float_format="%.2f")
# Use scientific notation
df.to_csv("example2.csv", float_format="{:.2e}".format)