-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: add sep argument to read_clipboard signature #14537
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: add sep argument to read_clipboard signature #14537
Conversation
keshavramaswamy
commented
Oct 29, 2016
•
edited by jorisvandenbossche
Loading
edited by jorisvandenbossche
- closes DOC: give read_clipboard a signature #13726
Current coverage is 85.26% (diff: 100%)@@ master #14537 diff @@
==========================================
Files 140 140
Lines 50693 50672 -21
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 43229 43208 -21
Misses 7464 7464
Partials 0 0
|
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 verify that we have tests for all the cases of sep
and delim_whitespace
, and maybe add a few if we don't?
""" | ||
Read text from clipboard and pass to read_table. See read_table for the | ||
full argument list | ||
|
||
If unspecified, `sep` defaults to '\s+' | ||
If unspecified, `sep` defaults to '\s+' and delim_whitespace defaults |
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.
Take a look at the NumPy docstring reference, which we try to follow. So this would be something like like
sep : str, optional
A string or regex delimiter. Default `'\s+'`
delim_whitespace : bool, optional
Whether to .... Default False
|
||
return read_table(StringIO(text), **kwargs) | ||
return read_table(StringIO(text), sep, delim_whitespace, **kwargs) |
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 make these keyword arguments (sep=sep, delim_whitespace=delim_whitespace
)
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.
@TomAugspurger Thanks for your review. Will push in the required changes.
I would not list So would only list |
@jorisvandenbossche Thanks for your review. While that makes sense, as issue #13726 mentions, with both the arguments added, it'll be helpful for argument completion in interactive use. Thoughts? |
The point I was trying to make is that in the current way they are specified, having both arguments is not useful: Towards the users, I would maybe rather make |
@jorisvandenbossche ah, got it. Will remove |
@TomAugspurger Can this be merged? |
@@ -71,6 +71,7 @@ def check_round_trip_frame(self, data_type, excel=None, sep=None): | |||
def test_round_trip_frame_sep(self): |
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.
Do you think you can add round-trip tests for slightly unusual delimiters instead of the standard white-space one? One is probably sufficient.
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.
This actually just used read_csv
under the hood, so I don't know to what extent this is needed? (apart from checking that the keyword is passed correctly)
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.
True, but if the implementation changes, we would like to make sure such behaviour does not break. In any case, couldn't hurt, right? 😄
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.
@gfyoung not sure what you exactly mean by 'round-trip tests', I added a test for pipe-delimiter though.
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.
That's what the test method name is describing, which is why I put the comment under the name. What you did should be fine.
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.
Thanks @gfyoung - got it.
Parameters | ||
---------- | ||
sep : str, default '\s+' | ||
A string or regex delimiter. |
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 add here an explanation of what \s+
means ?
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.
Added that! @jorisvandenbossche
Looks like the build fails due to this? pypa/pip#4059 |
@keshavramaswamy Thanks a lot! (I made a small adjustment before merging, and made the docstring a raw string, which is needed for sphinx to interpret the |