Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ENH: Allow compression in NDFrame.to_csv to be a dict with optional arguments (#26023) #26024
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: Allow compression in NDFrame.to_csv to be a dict with optional arguments (#26023) #26024
Changes from 1 commit
4e73dc4
ab7620d
2e782f9
83e8834
d238878
b41be54
60ea58c
8ba9082
0a3a9fd
a1cb3f7
af2a96c
5853a28
789751f
5b09e6f
68a2b4d
c856f50
8df6c81
40d0252
18a735d
103c877
b6c34bc
969d387
abfbc0f
04ae25d
9c22652
56a75c2
bbfea34
7717f16
779511e
780eb04
6c4e679
1b567c9
9324b63
7cf65ee
29374f3
6701aa4
0f5489d
e04138e
6f2bf00
865aa81
8d1deee
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I would make this
whatsnew
note a little more generic. In reality, we should be just accepting any keyword arguments toBytesZipFile
. Also, we should have an example.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.
Can you rename this to
archive_name
?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.
@WillAyd The specific instance of
arcname
above is no longer there; Though, do you mean changearcname
toarchive_name
in general, including the dict key?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.
didn't you change get_filepath_or_buffer to already handle this? why is this special cased here?
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.
I did not modify
get_filepath_or_buffer
, though I suppose I certainly could to support taking adict
ascompression
. Theself._compression_arg
is there to avoid changingself.compression
from only ever holding the inferred compression method, whileself._compression_arg
would include any additional arguments ifcompression
was passed as adict
. I do now think that I should have instead had aself.compression_args
hold this dict with themethod
key popped.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.
@jreback With regard to
get_filepath_or_buffer
(and similarly_infer_compression
), I've added a function_get_compression_method
which handles the case wherecompression
is given as adict
toto_csv
,CSVFormatter
or_get_handle
. It extracts the compression method string before passing toget_filepath_buffer
or_infer_compression
.Would it be preferable then to keep both functions' original functionality where
compression
may only be a string/None, as neither need the additional arguments, or include a call to_get_compression_method
in both to handle dicts?