-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: fix return type of str.extract #22562
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 1 commit
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 |
---|---|---|
|
@@ -854,8 +854,8 @@ def str_extract(arr, pat, flags=0, expand=True): | |
pat : string | ||
Regular expression pattern with capturing groups. | ||
flags : int, default 0 (no flags) | ||
``re`` module flags, e.g. ``re.IGNORECASE``. | ||
See :mod:`re` | ||
One of the ``re`` module flags, e.g. ``re.IGNORECASE``. | ||
See :mod:`re`. | ||
expand : bool, default True | ||
If True, return DataFrame with one column per capture group. | ||
If False, return a Series/Index if there is one capture group | ||
|
@@ -865,13 +865,15 @@ def str_extract(arr, pat, flags=0, expand=True): | |
|
||
Returns | ||
------- | ||
DataFrame with one row for each subject string, and one column for | ||
each group. Any capture group names in regular expression pat will | ||
be used for column names; otherwise capture group numbers will be | ||
used. The dtype of each result column is always object, even when | ||
no match is found. If expand=False and pat has only one capture group, | ||
then return a Series (if subject is a Series) or Index (if subject | ||
is an Index). | ||
DataFrame | ||
A DataFrame with one row for each subject string, and one | ||
column for each group. Any capture group names in regular | ||
expression pat will be used for column names; otherwise | ||
capture group numbers will be used. The dtype of each result | ||
column is always object, even when no match is found. If | ||
expand=False and pat has only one capture group, then return | ||
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. can you add double backticks around 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. Done! |
||
a Series (if subject is a Series) or Index (if subject is an | ||
Index). | ||
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. according to this, it can also return a 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. Done! I addressed the above three issues in one commit. Hopefully it works. Next time, I suppose I should separate them. |
||
|
||
See Also | ||
-------- | ||
|
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 mind briefly explaining what these flags are about. Nothing long, but something a bit more descriptive than what we've got now just linking to the
re
documentation. Something like "Flags that modify regular expression matching for things like case, spaces, etc."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.
Done!