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 7b9a477 commit bbe860fCopy full SHA for bbe860f
pandas/core/generic.py
@@ -3878,6 +3878,13 @@ 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
3884
+ - Format floats to two decimal places:
3885
+ >>> df.to_csv("out1.csv", float_format="%.2f") # doctest: +SKIP
3886
+ - Use scientific notation:
3887
+ >>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP
3888
"""
3889
df = self if isinstance(self, ABCDataFrame) else self.to_frame()
3890
0 commit comments