-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add example to extract docstring, and re-explain change to match. #5826
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
Compare to the string method match, which returns re.match objects. | ||
Examples | ||
-------- | ||
# A pattern with one group will return a Series. Non-matches will be NaN. |
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.
No need for the #
. Just the explanation line, optionally ending with a :
, then a blank line, and then the code example. In that case, the code example will be rendered nicely as code. Like this:
A pattern with more than one group will return a DataFrame:
>>> Series(['a1', 'b2', 'c3']).str.extract('([ab])(\d)')
Named groups will become column names in the result:
...
Nice examples in the docstring! I added some comments related to numpy's docstring standard. And a suggestion, while you are at it, maybe you could also add a 'See also' section to refer to |
looks good.... lmk when you are ready for merging... |
Thanks for the help, @jorisvandenbossche . I read up on the numpy documentation standard. Ready to merge. |
DOC: Add example to extract docstring, and re-explain change to match.
@danielballan thanks...the py2.6 failure was bogus... |
boolean Series | ||
if as_indexer=True | ||
Series of tuples | ||
if as_indexer=False, default but deprecated | ||
|
||
Returns |
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.
You forgot to remove the old 'return'
@danielballan I added some more comments. Do you want to handle it a new PR (otherwise I can also do it)? |
Ah, I thought you wanted output only for the first example, for brevity. I should have asked for clarification. See #5838 . |
@danielballan yeah, maybe that wasn't very clear. But I think the examples are much more valuable to users if you can see in a glimpse the possible outputs. |
@jreback, I added examples per your request in #5099. Also, I rewrote the explanation of how
str.match
is changing, which I left confusing and wordy before.