We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4dd266c commit a80ed86Copy full SHA for a80ed86
pandas/core/generic.py
@@ -3878,6 +3878,12 @@ def to_csv(
3878
>>> import os # doctest: +SKIP
3879
>>> os.makedirs("folder/subfolder", exist_ok=True) # doctest: +SKIP
3880
>>> df.to_csv("folder/subfolder/out.csv") # doctest: +SKIP
3881
+
3882
+ Format floating-point numbers using float_format:
3883
+ - Format floats to two decimal places:
3884
+ >>> df.to_csv("out1.csv", float_format="%.2f") # doctest: +SKIP
3885
+ - Use scientific notation:
3886
+ >>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP
3887
"""
3888
df = self if isinstance(self, ABCDataFrame) else self.to_frame()
3889
0 commit comments