-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
DOC: Improved the docstring of Series.str.findall #19982
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
Merged
jorisvandenbossche
merged 11 commits into
pandas-dev:master
from
jcontesti:docstring_series_str_findall
Mar 10, 2018
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fe09b66
First try of my docstring
jcontesti a227404
DOC: Improved the docstring of Series.str.findall
jcontesti 4909526
Merge remote-tracking branch 'upstream/master' into docstring_series_…
jcontesti 9689ce6
Merge remote-tracking branch 'upstream/master' into docstring_series_…
jcontesti ce333e4
DOC: fixing PR Series.str.findall: str is now string, text correction…
jcontesti 19854e1
Default 0 moved after int, improved explanation of extractall, patter…
jcontesti 5e364a3
Merge remote-tracking branch 'upstream/master' into docstring_series_…
jcontesti c688b50
Format of default value changed
jcontesti 62c6a5a
re is now in double backtick quotes
jcontesti 31b7919
small edits
jorisvandenbossche cd7223b
final edit
jorisvandenbossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
First try of my docstring
- Loading branch information
commit fe09b6680e18065ccbd7769e39b56bd8b9927c86
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -898,8 +898,10 @@ def str_join(arr, sep): | |
|
||
def str_findall(arr, pat, flags=0): | ||
""" | ||
Find all occurrences of pattern or regular expression in the | ||
Series/Index. Equivalent to :func:`re.findall`. | ||
Find all occurrences of pattern or regular expression in the Series/Index. | ||
|
||
Equivalent to apply :func:`re.findall` to all the elements in the | ||
Series/Index. Empty matches are included in the result. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -910,11 +912,60 @@ def str_findall(arr, pat, flags=0): | |
|
||
Returns | ||
------- | ||
matches : Series/Index of lists | ||
matches : Series/Index of lists of strings, with all non-overlapping | ||
matches of pattern or regular expression in each string 8000 of this | ||
Series/Index | ||
|
||
See Also | ||
-------- | ||
extractall : returns DataFrame with one column per capture group | ||
Series.str.extractall : For each subject string in the Series, extract \ | ||
groups from all matches of regular expression pat | ||
Series.str.count : Count occurrences of pattern in each string of the \ | ||
Series/Index | ||
re.findall: Return all non-overlapping matches of pattern in string, \ | ||
as a list of strings | ||
|
||
Examples | ||
-------- | ||
|
||
>>> s = pd.Series(['Lion', 'Monkey', 'Rabbit']) | ||
>>> s.str.findall('Monkey') | ||
0 [] | ||
1 [Monkey] | ||
2 [] | ||
dtype: object | ||
|
||
>>> s.str.findall('MONKEY') | ||
0 [] | ||
1 [] | ||
2 [] | ||
dtype: object | ||
|
||
>>> s.str.findall('MONKEY', flags=re.IGNORECASE) | ||
0 [] | ||
1 [Monkey] | ||
2 [] | ||
dtype: object | ||
|
||
>>> s.str.findall('on') | ||
0 [on] | ||
1 [on] | ||
2 [] | ||
dtype: object | ||
|
||
>>> s.str.findall('on$') | ||
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 put a small sentence before the example explaining what it is doing or why the result is as it is? (for the others as well) |
||
0 [on] | ||
1 [] | ||
2 [] | ||
dtype: object | ||
|
||
>>> s.str.findall('b') | ||
0 [] | ||
1 [] | ||
2 [b, b] | ||
dtype: object | ||
|
||
|
||
""" | ||
regex = re.compile(pat, flags=flags) | ||
return _na_map(regex.findall, arr) | ||
|
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.
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.
apply -> applying ?