-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Examples added for float_format in to_csv documentation #60457
Conversation
@rhshadrach Please check if the examples are appropriate. |
@@ -193,25 +193,25 @@ Visualization | |||
|
|||
Installable with ``pip install "pandas[plot, output-formatting]"``. | |||
|
|||
========================= ================== ================== ============================================================= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you undo all the changes in this file? They don't appear related to the linked issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pandas/core/generic.py
Outdated
Format floating-point numbers using float_format: | ||
- Format floats to two decimal places: | ||
>>> df.to_csv("out1.csv", float_format="%.2f") # doctest: +SKIP | ||
- Use scientific notation: | ||
>>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format floating-point numbers using float_format: | |
- Format floats to two decimal places: | |
>>> df.to_csv("out1.csv", float_format="%.2f") # doctest: +SKIP | |
- Use scientific notation: | |
>>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP | |
Format floats to two decimal places: | |
>>> df.to_csv("out1.csv", float_format="%.2f") # doctest: +SKIP | |
Format floats using scientific notation: | |
>>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP |
@mroeschke The reviewed changes are corrected, have a check and let me know if further changes are required. |
@mroeschke The code is changed accordingly to the reviewed changes, don't know why the tests are failing, can you please help me with it? |
pandas/core/generic.py
Outdated
|
||
Format floats using scientific notation: | ||
|
||
>>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> df.to_csv("out2.csv", float_format="{:.2e}".format) # doctest: +SKIP | |
>>> df.to_csv("out2.csv", float_format="{{:.2e}}".format) # doctest: +SKIP |
Thanks @Uvi-12 |
@mroeschke Thank you for the reviews, that helped a lot. |
Closes #60363