-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Include df.attrs
metadata in to_csv
output
#53816
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
ENH: Include df.attrs
metadata in to_csv
output
#53816
Conversation
df.attrs
metadata in to_csv
output
@@ -3636,6 +3636,7 @@ def to_csv( | |||
decimal: str = ..., | |||
errors: OpenFileErrors = ..., | |||
storage_options: StorageOptions = ..., | |||
comment: str | None = ..., |
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.
Why is this string and not bool?
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.
It was intended to mirror the read_csv
parameter for consistency between the two. Setting it will write the comments with that prefix.
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This new functionality writes DataFrame metadata stored in df.attrs as header/comment lines at the top of a CSV file.
The
to_csv()
method had acomment
param added to its call, matching theread_csv()
method signatureIf this param is set all key/values will be written to the beginning of the CSV file in the following format
[comment][key]:[value]
There was previous PR for this (#53740) that I closed. I accidentally butchered that previous branch, this is the new PR with a clean, fresh branch