-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC update DataFrame.to_csv write modes (#51839) #51881
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
Changes from 6 commits
6b4d5f7
2262c56
94ac0b7
2cf3308
0e26363
bff7ccd
c609257
51a5bbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3635,9 +3635,17 @@ def to_csv( | |
sequence should be given if the object uses MultiIndex. If | ||
False do not print fields for index names. Use index_label=False | ||
for easier importing in R. | ||
mode : str, default 'w' | ||
Python write mode. The available write modes are the same as | ||
:py:func:`open`. | ||
mode : {{'w', 'x', 'a'}}, default 'w' | ||
Forwarded to either `open(mode=)` or `fsspec.open(mode=)` to control | ||
the file opening. Typical values include: | ||
|
||
- 'w', open for writing, truncating the file first. | ||
- 'x', open for exclusive creation, failing if the file already exists. | ||
- 'a', open for writing, appending to the end of file if it exists. | ||
|
||
Including 'b' or 't' in the mode parameter will inform Pandas whether | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually use pandas lowercase. |
||
`path_or_buf` requires string or binary data. However, in most cases, | ||
this should not be necessary. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good point, but I don't think it makes sense to have binary csv files. I think this was a comment in the issue, about using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your input. I also think the same, but we had a discussion with @twoertwein earlier here #51881 (comment). Could you please share your thoughts on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that part is more confusing than helpful, feel free to remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for clarifying. I agree with these comments in general, bit I don't think in this particular case it's possible to binary data. Csv relies on the delimiter, the quote character and the line break to understand the structure. Binary data could have any of those and break a csv. Unless I'm missing something, it's not that in most cases "b" shouldn't be used, it can never be used. To me it makes more sense to remove that comment, since I think it's giving the impression that users can actually use binary csv's in some cases, and some may start researching about it. So, probably a bit confusing and distracting. Feel free to disagree, but that's how I feel about that comment. |
||
encoding : str, optional | ||
A string representing the encoding to use in the output file, | ||
defaults to 'utf-8'. `encoding` is not supported if `path_or_buf` | ||
|
Uh oh!
There was an error while loading. Please reload this page.