-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Make to_csv return a string if no path or buffer is provided. #6406
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
Conversation
this needs a test to validate that the return value is in fact a string. |
@@ -943,7 +943,7 @@ def grouper(x): | |||
|
|||
class CSVFormatter(object): | |||
|
|||
def __init__(self, obj, path_or_buf, sep=",", na_rep='', float_format=None, | |||
def __init__(self, obj, buf=None, sep=",", na_rep='', float_format=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.
don't change this argument name, leave it as is
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.
Isn't it sensible to have this the same in all formatters?
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.
the other ones are wrong actually (see to_hdf,to_msgpack,to_json). Those I agree their is some incosistency. put back the path_or_buf
...I'll make an issue to harmonize the rest of them (it doesn't matter much really because you are rarely specifying this by kw).
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.
actually it IS pretty consistent with path_or_buf
, except for the ones which only (current) take a fname, e.g. to_stat
, and to_excel
. all the others take just a buffer
I added a test and reverted to the |
@jorisvandenbossche @cpcloud think we need any more tests on this? |
can you add a release note (API section on this) |
Done. |
Make to_csv return a string if no path or buffer is provided.
thanks! |
Fixes #6061.