neulab/docprompting-conala huggingface dataset:
pandas.Series.str.extract   Series.str.extract(pat, flags=0, expand=True)[source]
 
Extract capture groups in the regex pat as columns in a DataFrame. For each subject string in the Series, extract groups from the first match of regular expression pat.  Parameters 
 
pat:str


Regular expression pattern with capturing groups.  
flags:int, default 0 (no flags)


Flags from the re module, e.g. re.IGNORECASE, that modify regular expression matching for things like case, spaces, etc. For more details, see 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 or DataFrame if there are multiple capture groups.    Returns 
 DataFrame or Series or Index

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 a Series (if subject is a Series) or Index (if subject is an Index).      See also  extractall

Returns all matches (not just the first match).    Examples A pattern with two groups will return a DataFrame with two columns. Non-matches will be NaN. 
>>> s = pd.Series(['a1', 'b2', 'c3'])
>>> s.str.extract(r'([ab])(\d)')
    0    1
0    a    1
1    b    2
2  NaN  NaN
  A pattern may contain optional groups. 
>>> s.str.extract(r'([ab])?(\d)')
    0  1
0    a  1
1    b  2
2  NaN  3
  Named groups will become column names in the result. 
>>> s.str.extract(r'(?P<letter>[ab])(?P<digit>\d)')
letter digit
0      a     1
1      b     2
2    NaN   NaN
  A pattern with one group will return a DataFrame with one column if expand=True. 
>>> s.str.extract(r'[ab](\d)', expand=True)
    0
0    1
1    2
2  NaN
  A pattern with one group will return a Series if expand=False. 
>>> s.str.extract(r'[ab](\d)', expand=False)
0      1
1      2
2    NaN
dtype: object
pandas.Series.str.extractall   Series.str.extractall(pat, flags=0)[source]
 
Extract capture groups in the regex pat as columns in DataFrame. For each subject string in the Series, extract groups from all matches of regular expression pat. When each subject string in the Series has exactly one match, extractall(pat).xs(0, level=’match’) is the same as extract(pat).  Parameters 
 
pat:str


Regular expression pattern with capturing groups.  
flags:int, default 0 (no flags)


A re module flag, for example re.IGNORECASE. These allow to modify regular expression matching for things like case, spaces, etc. Multiple flags can be combined with the bitwise OR operator, for example re.IGNORECASE | re.MULTILINE.    Returns 
 DataFrame

A DataFrame with one row for each match, and one column for each group. Its rows have a MultiIndex with first levels that come from the subject Series. The last level is named ‘match’ and indexes the matches in each item of the Series. Any capture group names in regular expression pat will be used for column names; otherwise capture group numbers will be used.      See also  extract

Returns first match only (not all matches).    Examples A pattern with one group will return a DataFrame with one column. Indices with no matches will not appear in the result. 
>>> s = pd.Series(["a1a2", "b1", "c1"], index=["A", "B", "C"])
>>> s.str.extractall(r"[ab](\d)")
        0
match
A 0      1
  1      2
B 0      1
  Capture group names are used for column names of the result. 
>>> s.str.extractall(r"[ab](?P<digit>\d)")
        digit
match
A 0         1
  1         2
B 0         1
  A pattern with two groups will return a DataFrame with two columns. 
>>> s.str.extractall(r"(?P<letter>[ab])(?P<digit>\d)")
        letter digit
match
A 0          a     1
  1          a     2
B 0          b     1
  Optional groups that do not match are NaN in the result. 
>>> s.str.extractall(r"(?P<letter>[ab])?(?P<digit>\d)")
        letter digit
match
A 0          a     1
  1          a     2
B 0          b     1
C 0        NaN     1
pandas.Series.str.find   Series.str.find(sub, start=0, end=None)[source]
 
Return lowest indexes in each strings in the Series/Index. Each of returned indexes corresponds to the position where the substring is fully contained between [start:end]. Return -1 on failure. Equivalent to standard str.find().  Parameters 
 
sub:str


Substring being searched.  
start:int


Left edge index.  
end:int


Right edge index.    Returns 
 Series or Index of int.
    See also  rfind

Return highest indexes in each strings.
pandas.Series.str.findall   Series.str.findall(pat, flags=0)[source]
 
Find all occurrences of pattern or regular expression in the Series/Index. Equivalent to applying re.findall() to all the elements in the Series/Index.  Parameters 
 
pat:str


Pattern or regular expression.  
flags:int, default 0


Flags from re module, e.g. re.IGNORECASE (default is 0, which means no flags).    Returns 
 Series/Index of lists of strings

All non-overlapping matches of pattern or regular expression in each string of this Series/Index.      See also  count

Count occurrences of pattern or regular expression in each string of the Series/Index.  extractall

For each string in the Series, extract groups from all matches of regular expression and return a DataFrame with one row for each match and one column for each group.  re.findall

The equivalent re function to all non-overlapping matches of pattern or regular expression in string, as a list of strings.    Examples 
>>> s = pd.Series(['Lion', 'Monkey', 'Rabbit'])
  The search for the pattern ‘Monkey’ returns one match: 
>>> s.str.findall('Monkey')
0          []
1    [Monkey]
2          []
dtype: object
  On the other hand, the search for the pattern ‘MONKEY’ doesn’t return any match: 
>>> s.str.findall('MONKEY')
0    []
1    []
2    []
dtype: object
  Flags can be added to the pattern or regular expression. For instance, to find the pattern ‘MONKEY’ ignoring the case: 
>>> import re
>>> s.str.findall('MONKEY', flags=re.IGNORECASE)
0          []
1    [Monkey]
2          []
dtype: object
  When the pattern matches more than one string in the Series, all matches are returned: 
>>> s.str.findall('on')
0    [on]
1    [on]
2      []
dtype: object
  Regular expressions are supported too. For instance, the search for all the strings ending with the word ‘on’ is shown next: 
>>> s.str.findall('on$')
0    [on]
1      []
2      []
dtype: object
  If the pattern is found more than once in the same string, then a list of multiple strings is returned: 
>>> s.str.findall('b')
0        []
1        []
2    [b, b]
dtype: object
pandas.Series.str.fullmatch   Series.str.fullmatch(pat, case=True, flags=0, na=None)[source]
 
Determine if each string entirely matches a regular expression.  New in version 1.1.0.   Parameters 
 
pat:str


Character sequence or regular expression.  
case:bool, default True


If True, case sensitive.  
flags:int, default 0 (no flags)


Regex module flags, e.g. re.IGNORECASE.  
na:scalar, optional


Fill value for missing values. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.    Returns 
 Series/Index/array of boolean values
    See also  match

Similar, but also returns True when only a prefix of the string matches the regular expression.  extract

Extract matched groups.
pandas.Series.str.get   Series.str.get(i)[source]
 
Extract element from each component at specified position. Extract element from lists, tuples, or strings in each element in the Series/Index.  Parameters 
 
i:int


Position of element to extract.    Returns 
 Series or Index
   Examples 
>>> s = pd.Series(["String",
...               (1, 2, 3),
...               ["a", "b", "c"],
...               123,
...               -456,
...               {1: "Hello", "2": "World"}])
>>> s
0                        String
1                     (1, 2, 3)
2                     [a, b, c]
3                           123
4                          -456
5    {1: 'Hello', '2': 'World'}
dtype: object
  
>>> s.str.get(1)
0        t
1        2
2        b
3      NaN
4      NaN
5    Hello
dtype: object
  
>>> s.str.get(-1)
0      g
1      3
2      c
3    NaN
4    NaN
5    None
dtype: object
pandas.Series.str.get_dummies   Series.str.get_dummies(sep='|')[source]
 
Return DataFrame of dummy/indicator variables for Series. Each string in Series is split by sep and returned as a DataFrame of dummy/indicator variables.  Parameters 
 
sep:str, default “|”


String to split on.    Returns 
 DataFrame

Dummy variables corresponding to values of the Series.      See also  get_dummies

Convert categorical variable into dummy/indicator variables.    Examples 
>>> pd.Series(['a|b', 'a', 'a|c']).str.get_dummies()
   a  b  c
0  1  1  0
1  1  0  0
2  1  0  1
  
>>> pd.Series(['a|b', np.nan, 'a|c']).str.get_dummies()
   a  b  c
0  1  1  0
1  0  0  0
2  1  0  1
pandas.Series.str.index   Series.str.index(sub, start=0, end=None)[source]
 
Return lowest indexes in each string in Series/Index. Each of the returned indexes corresponds to the position where the substring is fully contained between [start:end]. This is the same as str.find except instead of returning -1, it raises a ValueError when the substring is not found. Equivalent to standard str.index.  Parameters 
 
sub:str


Substring being searched.  
start:int


Left edge index.  
end:int


Right edge index.    Returns 
 Series or Index of object
    See also  rindex

Return highest indexes in each strings.
pandas.Series.str.isalnum   Series.str.isalnum()[source]
 
Check whether all characters in each string are alphanumeric. This is equivalent to running the Python string method str.isalnum() for each element of the Series/Index. If a string has zero characters, False is returned for that check.  Returns 
 Series or Index of bool

Series or Index of boolean values with the same length as the original Series/Index.      See also  Series.str.isalpha

Check whether all characters are alphabetic.  Series.str.isnumeric

Check whether all characters are numeric.  Series.str.isalnum

Check whether all characters are alphanumeric.  Series.str.isdigit

Check whether all characters are digits.  Series.str.isdecimal

Check whether all characters are decimal.  Series.str.isspace

Check whether all characters are whitespace.  Series.str.islower

Check whether all characters are lowercase.  Series.str.isupper

Check whether all characters are uppercase.  Series.str.istitle

Check whether all characters are titlecase.    Examples Checks for Alphabetic and Numeric Characters 
>>> s1 = pd.Series(['one', 'one1', '1', ''])
  
>>> s1.str.isalpha()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s1.str.isnumeric()
0    False
1    False
2     True
3    False
dtype: bool
  
>>> s1.str.isalnum()
0     True
1     True
2     True
3    False
dtype: bool
  Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check. 
>>> s2 = pd.Series(['A B', '1.5', '3,000'])
>>> s2.str.isalnum()
0    False
1    False
2    False
dtype: bool
  More Detailed Checks for Numeric Characters There are several different but overlapping sets of numeric characters that can be checked for. 
>>> s3 = pd.Series(['23', '³', '⅕', ''])
  The s3.str.isdecimal method checks for characters used to form numbers in base 10. 
>>> s3.str.isdecimal()
0     True
1    False
2    False
3    False
dtype: bool
  The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode. 
>>> s3.str.isdigit()
0     True
1     True
2    False
3    False
dtype: bool
  The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions. 
>>> s3.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool
  Checks for Whitespace 
>>> s4 = pd.Series([' ', '\t\r\n ', ''])
>>> s4.str.isspace()
0     True
1     True
2    False
dtype: bool
  Checks for Character Case 
>>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', ''])
  
>>> s5.str.islower()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s5.str.isupper()
0    False
1    False
2     True
3    False
dtype: bool
  The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters. 
>>> s5.str.istitle()
0    False
1     True
2    False
3    False
dtype: bool
pandas.Series.str.isalpha   Series.str.isalpha()[source]
 
Check whether all characters in each string are alphabetic. This is equivalent to running the Python string method str.isalpha() for each element of the Series/Index. If a string has zero characters, False is returned for that check.  Returns 
 Series or Index of bool

Series or Index of boolean values with the same length as the original Series/Index.      See also  Series.str.isalpha

Check whether all characters are alphabetic.  Series.str.isnumeric

Check whether all characters are numeric.  Series.str.isalnum

Check whether all characters are alphanumeric.  Series.str.isdigit

Check whether all characters are digits.  Series.str.isdecimal

Check whether all characters are decimal.  Series.str.isspace

Check whether all characters are whitespace.  Series.str.islower

Check whether all characters are lowercase.  Series.str.isupper

Check whether all characters are uppercase.  Series.str.istitle

Check whether all characters are titlecase.    Examples Checks for Alphabetic and Numeric Characters 
>>> s1 = pd.Series(['one', 'one1', '1', ''])
  
>>> s1.str.isalpha()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s1.str.isnumeric()
0    False
1    False
2     True
3    False
dtype: bool
  
>>> s1.str.isalnum()
0     True
1     True
2     True
3    False
dtype: bool
  Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check. 
>>> s2 = pd.Series(['A B', '1.5', '3,000'])
>>> s2.str.isalnum()
0    False
1    False
2    False
dtype: bool
  More Detailed Checks for Numeric Characters There are several different but overlapping sets of numeric characters that can be checked for. 
>>> s3 = pd.Series(['23', '³', '⅕', ''])
  The s3.str.isdecimal method checks for characters used to form numbers in base 10. 
>>> s3.str.isdecimal()
0     True
1    False
2    False
3    False
dtype: bool
  The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode. 
>>> s3.str.isdigit()
0     True
1     True
2    False
3    False
dtype: bool
  The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions. 
>>> s3.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool
  Checks for Whitespace 
>>> s4 = pd.Series([' ', '\t\r\n ', ''])
>>> s4.str.isspace()
0     True
1     True
2    False
dtype: bool
  Checks for Character Case 
>>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', ''])
  
>>> s5.str.islower()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s5.str.isupper()
0    False
1    False
2     True
3    False
dtype: bool
  The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters. 
>>> s5.str.istitle()
0    False
1     True
2    False
3    False
dtype: bool
pandas.Series.str.isdecimal   Series.str.isdecimal()[source]
 
Check whether all characters in each string are decimal. This is equivalent to running the Python string method str.isdecimal() for each element of the Series/Index. If a string has zero characters, False is returned for that check.  Returns 
 Series or Index of bool

Series or Index of boolean values with the same length as the original Series/Index.      See also  Series.str.isalpha

Check whether all characters are alphabetic.  Series.str.isnumeric

Check whether all characters are numeric.  Series.str.isalnum

Check whether all characters are alphanumeric.  Series.str.isdigit

Check whether all characters are digits.  Series.str.isdecimal

Check whether all characters are decimal.  Series.str.isspace

Check whether all characters are whitespace.  Series.str.islower

Check whether all characters are lowercase.  Series.str.isupper

Check whether all characters are uppercase.  Series.str.istitle

Check whether all characters are titlecase.    Examples Checks for Alphabetic and Numeric Characters 
>>> s1 = pd.Series(['one', 'one1', '1', ''])
  
>>> s1.str.isalpha()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s1.str.isnumeric()
0    False
1    False
2     True
3    False
dtype: bool
  
>>> s1.str.isalnum()
0     True
1     True
2     True
3    False
dtype: bool
  Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check. 
>>> s2 = pd.Series(['A B', '1.5', '3,000'])
>>> s2.str.isalnum()
0    False
1    False
2    False
dtype: bool
  More Detailed Checks for Numeric Characters There are several different but overlapping sets of numeric characters that can be checked for. 
>>> s3 = pd.Series(['23', '³', '⅕', ''])
  The s3.str.isdecimal method checks for characters used to form numbers in base 10. 
>>> s3.str.isdecimal()
0     True
1    False
2    False
3    False
dtype: bool
  The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode. 
>>> s3.str.isdigit()
0     True
1     True
2    False
3    False
dtype: bool
  The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions. 
>>> s3.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool
  Checks for Whitespace 
>>> s4 = pd.Series([' ', '\t\r\n ', ''])
>>> s4.str.isspace()
0     True
1     True
2    False
dtype: bool
  Checks for Character Case 
>>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', ''])
  
>>> s5.str.islower()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s5.str.isupper()
0    False
1    False
2     True
3    False
dtype: bool
  The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters. 
>>> s5.str.istitle()
0    False
1     True
2    False
3    False
dtype: bool
pandas.Series.str.isdigit   Series.str.isdigit()[source]
 
Check whether all characters in each string are digits. This is equivalent to running the Python string method str.isdigit() for each element of the Series/Index. If a string has zero characters, False is returned for that check.  Returns 
 Series or Index of bool

Series or Index of boolean values with the same length as the original Series/Index.      See also  Series.str.isalpha

Check whether all characters are alphabetic.  Series.str.isnumeric

Check whether all characters are numeric.  Series.str.isalnum

Check whether all characters are alphanumeric.  Series.str.isdigit

Check whether all characters are digits.  Series.str.isdecimal

Check whether all characters are decimal.  Series.str.isspace

Check whether all characters are whitespace.  Series.str.islower

Check whether all characters are lowercase.  Series.str.isupper

Check whether all characters are uppercase.  Series.str.istitle

Check whether all characters are titlecase.    Examples Checks for Alphabetic and Numeric Characters 
>>> s1 = pd.Series(['one', 'one1', '1', ''])
  
>>> s1.str.isalpha()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s1.str.isnumeric()
0    False
1    False
2     True
3    False
dtype: bool
  
>>> s1.str.isalnum()
0     True
1     True
2     True
3    False
dtype: bool
  Note that checks against characters mixed with any additional punctuation or whitespace will evaluate to false for an alphanumeric check. 
>>> s2 = pd.Series(['A B', '1.5', '3,000'])
>>> s2.str.isalnum()
0    False
1    False
2    False
dtype: bool
  More Detailed Checks for Numeric Characters There are several different but overlapping sets of numeric characters that can be checked for. 
>>> s3 = pd.Series(['23', '³', '⅕', ''])
  The s3.str.isdecimal method checks for characters used to form numbers in base 10. 
>>> s3.str.isdecimal()
0     True
1    False
2    False
3    False
dtype: bool
  The s.str.isdigit method is the same as s3.str.isdecimal but also includes special digits, like superscripted and subscripted digits in unicode. 
>>> s3.str.isdigit()
0     True
1     True
2    False
3    False
dtype: bool
  The s.str.isnumeric method is the same as s3.str.isdigit but also includes other characters that can represent quantities such as unicode fractions. 
>>> s3.str.isnumeric()
0     True
1     True
2     True
3    False
dtype: bool
  Checks for Whitespace 
>>> s4 = pd.Series([' ', '\t\r\n ', ''])
>>> s4.str.isspace()
0     True
1     True
2    False
dtype: bool
  Checks for Character Case 
>>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', ''])
  
>>> s5.str.islower()
0     True
1    False
2    False
3    False
dtype: bool
  
>>> s5.str.isupper()
0    False
1    False
2     True
3    False
dtype: bool
  The s5.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters. 
>>> s5.str.istitle()
0    False
1     True
2    False
3    False
dtype: bool