neulab/docprompting-conala huggingface dataset:
pandas.Series.str.partition   Series.str.partition(sep=' ', expand=True)[source]
 
Split the string at the first occurrence of sep. This method splits the string at the first occurrence of sep, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing the string itself, followed by two empty strings.  Parameters 
 
sep:str, default whitespace


String to split on.  
expand:bool, default True


If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index.    Returns 
 DataFrame/MultiIndex or Series/Index of objects
    See also  rpartition

Split the string at the last occurrence of sep.  Series.str.split

Split strings around given separators.  str.partition

Standard library version.    Examples 
>>> s = pd.Series(['Linda van der Berg', 'George Pitt-Rivers'])
>>> s
0    Linda van der Berg
1    George Pitt-Rivers
dtype: object
  
>>> s.str.partition()
        0  1             2
0   Linda     van der Berg
1  George      Pitt-Rivers
  To partition by the last space instead of the first one: 
>>> s.str.rpartition()
               0  1            2
0  Linda van der            Berg
1         George     Pitt-Rivers
  To partition by something different than a space: 
>>> s.str.partition('-')
                    0  1       2
0  Linda van der Berg
1         George Pitt  -  Rivers
  To return a Series containing tuples instead of a DataFrame: 
>>> s.str.partition('-', expand=False)
0    (Linda van der Berg, , )
1    (George Pitt, -, Rivers)
dtype: object
  Also available on indices: 
>>> idx = pd.Index(['X 123', 'Y 999'])
>>> idx
Index(['X 123', 'Y 999'], dtype='object')
  Which will create a MultiIndex: 
>>> idx.str.partition()
MultiIndex([('X', ' ', '123'),
            ('Y', ' ', '999')],
           )
  Or an index with tuples with expand=False: 
>>> idx.str.partition(expand=False)
Index([('X', ' ', '123'), ('Y', ' ', '999')], dtype='object')
pandas.Series.str.removeprefix   Series.str.removeprefix(prefix)[source]
 
Remove a prefix from an object series. If the prefix is not present, the original string will be returned.  Parameters 
 
prefix:str


Remove the prefix of the string.    Returns 
 Series/Index: object

The Series or Index with given prefix removed.      See also  Series.str.removesuffix

Remove a suffix from an object series.    Examples 
>>> s = pd.Series(["str_foo", "str_bar", "no_prefix"])
>>> s
0    str_foo
1    str_bar
2    no_prefix
dtype: object
>>> s.str.removeprefix("str_")
0    foo
1    bar
2    no_prefix
dtype: object
  
>>> s = pd.Series(["foo_str", "bar_str", "no_suffix"])
>>> s
0    foo_str
1    bar_str
2    no_suffix
dtype: object
>>> s.str.removesuffix("_str")
0    foo
1    bar
2    no_suffix
dtype: object
pandas.Series.str.removesuffix   Series.str.removesuffix(suffix)[source]
 
Remove a suffix from an object series. If the suffix is not present, the original string will be returned.  Parameters 
 
suffix:str


Remove the suffix of the string.    Returns 
 Series/Index: object

The Series or Index with given suffix removed.      See also  Series.str.removeprefix

Remove a prefix from an object series.    Examples 
>>> s = pd.Series(["str_foo", "str_bar", "no_prefix"])
>>> s
0    str_foo
1    str_bar
2    no_prefix
dtype: object
>>> s.str.removeprefix("str_")
0    foo
1    bar
2    no_prefix
dtype: object
  
>>> s = pd.Series(["foo_str", "bar_str", "no_suffix"])
>>> s
0    foo_str
1    bar_str
2    no_suffix
dtype: object
>>> s.str.removesuffix("_str")
0    foo
1    bar
2    no_suffix
dtype: object
pandas.Series.str.repeat   Series.str.repeat(repeats)[source]
 
Duplicate each string in the Series or Index.  Parameters 
 
repeats:int or sequence of int


Same value for all (int) or different value per (sequence).    Returns 
 Series or Index of object

Series or Index of repeated string objects specified by input parameter repeats.     Examples 
>>> s = pd.Series(['a', 'b', 'c'])
>>> s
0    a
1    b
2    c
dtype: object
  Single int repeats string in Series 
>>> s.str.repeat(repeats=2)
0    aa
1    bb
2    cc
dtype: object
  Sequence of int repeats corresponding string in Series 
>>> s.str.repeat(repeats=[1, 2, 3])
0      a
1     bb
2    ccc
dtype: object
pandas.Series.str.rfind   Series.str.rfind(sub, start=0, end=None)[source]
 
Return highest 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.rfind().  Parameters 
 
sub:str


Substring being searched.  
start:int


Left edge index.  
end:int


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

Return lowest indexes in each strings.
pandas.Series.str.rindex   Series.str.rindex(sub, start=0, end=None)[source]
 
Return highest 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.rfind except instead of returning -1, it raises a ValueError when the substring is not found. Equivalent to standard str.rindex.  Parameters 
 
sub:str


Substring being searched.  
start:int


Left edge index.  
end:int


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

Return lowest indexes in each strings.
pandas.Series.str.rjust   Series.str.rjust(width, fillchar=' ')[source]
 
Pad left side of strings in the Series/Index. Equivalent to str.rjust().  Parameters 
 
width:int


Minimum width of resulting string; additional characters will be filled with fillchar.  
fillchar:str


Additional character for filling, default is whitespace.    Returns 
 
filled:Series/Index of objects.
pandas.Series.str.rpartition   Series.str.rpartition(sep=' ', expand=True)[source]
 
Split the string at the last occurrence of sep. This method splits the string at the last occurrence of sep, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing two empty strings, followed by the string itself.  Parameters 
 
sep:str, default whitespace


String to split on.  
expand:bool, default True


If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index.    Returns 
 DataFrame/MultiIndex or Series/Index of objects
    See also  partition

Split the string at the first occurrence of sep.  Series.str.split

Split strings around given separators.  str.partition

Standard library version.    Examples 
>>> s = pd.Series(['Linda van der Berg', 'George Pitt-Rivers'])
>>> s
0    Linda van der Berg
1    George Pitt-Rivers
dtype: object
  
>>> s.str.partition()
        0  1             2
0   Linda     van der Berg
1  George      Pitt-Rivers
  To partition by the last space instead of the first one: 
>>> s.str.rpartition()
               0  1            2
0  Linda van der            Berg
1         George     Pitt-Rivers
  To partition by something different than a space: 
>>> s.str.partition('-')
                    0  1       2
0  Linda van der Berg
1         George Pitt  -  Rivers
  To return a Series containing tuples instead of a DataFrame: 
>>> s.str.partition('-', expand=False)
0    (Linda van der Berg, , )
1    (George Pitt, -, Rivers)
dtype: object
  Also available on indices: 
>>> idx = pd.Index(['X 123', 'Y 999'])
>>> idx
Index(['X 123', 'Y 999'], dtype='object')
  Which will create a MultiIndex: 
>>> idx.str.partition()
MultiIndex([('X', ' ', '123'),
            ('Y', ' ', '999')],
           )
  Or an index with tuples with expand=False: 
>>> idx.str.partition(expand=False)
Index([('X', ' ', '123'), ('Y', ' ', '999')], dtype='object')
pandas.Series.str.rstrip   Series.str.rstrip(to_strip=None)[source]
 
Remove trailing characters. Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from right side. Equivalent to str.rstrip().  Parameters 
 
to_strip:str or None, default None


Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.    Returns 
 Series or Index of object
    See also  Series.str.strip

Remove leading and trailing characters in Series/Index.  Series.str.lstrip

Remove leading characters in Series/Index.  Series.str.rstrip

Remove trailing characters in Series/Index.    Examples 
>>> s = pd.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', np.nan])
>>> s
0    1. Ant.
1    2. Bee!\n
2    3. Cat?\t
3          NaN
dtype: object
  
>>> s.str.strip()
0    1. Ant.
1    2. Bee!
2    3. Cat?
3        NaN
dtype: object
  
>>> s.str.lstrip('123.')
0    Ant.
1    Bee!\n
2    Cat?\t
3       NaN
dtype: object
  
>>> s.str.rstrip('.!? \n\t')
0    1. Ant
1    2. Bee
2    3. Cat
3       NaN
dtype: object
  
>>> s.str.strip('123.!? \n\t')
0    Ant
1    Bee
2    Cat
3    NaN
dtype: object
pandas.Series.str.slice   Series.str.slice(start=None, stop=None, step=None)[source]
 
Slice substrings from each element in the Series or Index.  Parameters 
 
start:int, optional


Start position for slice operation.  
stop:int, optional


Stop position for slice operation.  
step:int, optional


Step size for slice operation.    Returns 
 Series or Index of object

Series or Index from sliced substring from original string object.      See also  Series.str.slice_replace

Replace a slice with a string.  Series.str.get

Return element at position. Equivalent to Series.str.slice(start=i, stop=i+1) with i being the position.    Examples 
>>> s = pd.Series(["koala", "dog", "chameleon"])
>>> s
0        koala
1          dog
2    chameleon
dtype: object
  
>>> s.str.slice(start=1)
0        oala
1          og
2    hameleon
dtype: object
  
>>> s.str.slice(start=-1)
0           a
1           g
2           n
dtype: object
  
>>> s.str.slice(stop=2)
0    ko
1    do
2    ch
dtype: object
  
>>> s.str.slice(step=2)
0      kaa
1       dg
2    caeen
dtype: object
  
>>> s.str.slice(start=0, stop=5, step=3)
0    kl
1     d
2    cm
dtype: object
  Equivalent behaviour to: 
>>> s.str[0:5:3]
0    kl
1     d
2    cm
dtype: object
pandas.Series.str.slice_replace   Series.str.slice_replace(start=None, stop=None, repl=None)[source]
 
Replace a positional slice of a string with another value.  Parameters 
 
start:int, optional


Left index position to use for the slice. If not specified (None), the slice is unbounded on the left, i.e. slice from the start of the string.  
stop:int, optional


Right index position to use for the slice. If not specified (None), the slice is unbounded on the right, i.e. slice until the end of the string.  
repl:str, optional


String for replacement. If not specified (None), the sliced region is replaced with an empty string.    Returns 
 Series or Index

Same type as the original object.      See also  Series.str.slice

Just slicing without replacement.    Examples 
>>> s = pd.Series(['a', 'ab', 'abc', 'abdc', 'abcde'])
>>> s
0        a
1       ab
2      abc
3     abdc
4    abcde
dtype: object
  Specify just start, meaning replace start until the end of the string with repl. 
>>> s.str.slice_replace(1, repl='X')
0    aX
1    aX
2    aX
3    aX
4    aX
dtype: object
  Specify just stop, meaning the start of the string to stop is replaced with repl, and the rest of the string is included. 
>>> s.str.slice_replace(stop=2, repl='X')
0       X
1       X
2      Xc
3     Xdc
4    Xcde
dtype: object
  Specify start and stop, meaning the slice from start to stop is replaced with repl. Everything before or after start and stop is included as is. 
>>> s.str.slice_replace(start=1, stop=3, repl='X')
0      aX
1      aX
2      aX
3     aXc
4    aXde
dtype: object
pandas.Series.str.startswith   Series.str.startswith(pat, na=None)[source]
 
Test if the start of each string element matches a pattern. Equivalent to str.startswith().  Parameters 
 
pat:str


Character sequence. Regular expressions are not accepted.  
na:object, default NaN


Object shown if element tested is not a string. The default depends on dtype of the array. For object-dtype, numpy.nan is used. For StringDtype, pandas.NA is used.    Returns 
 Series or Index of bool

A Series of booleans indicating whether the given pattern matches the start of each string element.      See also  str.startswith

Python standard library string method.  Series.str.endswith

Same as startswith, but tests the end of string.  Series.str.contains

Tests if string element contains a pattern.    Examples 
>>> s = pd.Series(['bat', 'Bear', 'cat', np.nan])
>>> s
0     bat
1    Bear
2     cat
3     NaN
dtype: object
  
>>> s.str.startswith('b')
0     True
1    False
2    False
3      NaN
dtype: object
  Specifying na to be False instead of NaN. 
>>> s.str.startswith('b', na=False)
0     True
1    False
2    False
3    False
dtype: bool
pandas.Series.str.strip   Series.str.strip(to_strip=None)[source]
 
Remove leading and trailing characters. Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from left and right sides. Equivalent to str.strip().  Parameters 
 
to_strip:str or None, default None


Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.    Returns 
 Series or Index of object
    See also  Series.str.strip

Remove leading and trailing characters in Series/Index.  Series.str.lstrip

Remove leading characters in Series/Index.  Series.str.rstrip

Remove trailing characters in Series/Index.    Examples 
>>> s = pd.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', np.nan])
>>> s
0    1. Ant.
1    2. Bee!\n
2    3. Cat?\t
3          NaN
dtype: object
  
>>> s.str.strip()
0    1. Ant.
1    2. Bee!
2    3. Cat?
3        NaN
dtype: object
  
>>> s.str.lstrip('123.')
0    Ant.
1    Bee!\n
2    Cat?\t
3       NaN
dtype: object
  
>>> s.str.rstrip('.!? \n\t')
0    1. Ant
1    2. Bee
2    3. Cat
3       NaN
dtype: object
  
>>> s.str.strip('123.!? \n\t')
0    Ant
1    Bee
2    Cat
3    NaN
dtype: object
pandas.Series.str.swapcase   Series.str.swapcase()[source]
 
Convert strings in the Series/Index to be swapcased. Equivalent to str.swapcase().  Returns 
 Series or Index of object
    See also  Series.str.lower

Converts all characters to lowercase.  Series.str.upper

Converts all characters to uppercase.  Series.str.title

Converts first character of each word to uppercase and remaining to lowercase.  Series.str.capitalize

Converts first character to uppercase and remaining to lowercase.  Series.str.swapcase

Converts uppercase to lowercase and lowercase to uppercase.  Series.str.casefold

Removes all case distinctions in the string.    Examples 
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s
0                 lower
1              CAPITALS
2    this is a sentence
3              SwApCaSe
dtype: object
  
>>> s.str.lower()
0                 lower
1              capitals
2    this is a sentence
3              swapcase
dtype: object
  
>>> s.str.upper()
0                 LOWER
1              CAPITALS
2    THIS IS A SENTENCE
3              SWAPCASE
dtype: object
  
>>> s.str.title()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: object
  
>>> s.str.capitalize()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: object
  
>>> s.str.swapcase()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: object
pandas.Series.str.title   Series.str.title()[source]
 
Convert strings in the Series/Index to titlecase. Equivalent to str.title().  Returns 
 Series or Index of object
    See also  Series.str.lower

Converts all characters to lowercase.  Series.str.upper

Converts all characters to uppercase.  Series.str.title

Converts first character of each word to uppercase and remaining to lowercase.  Series.str.capitalize

Converts first character to uppercase and remaining to lowercase.  Series.str.swapcase

Converts uppercase to lowercase and lowercase to uppercase.  Series.str.casefold

Removes all case distinctions in the string.    Examples 
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s
0                 lower
1              CAPITALS
2    this is a sentence
3              SwApCaSe
dtype: object
  
>>> s.str.lower()
0                 lower
1              capitals
2    this is a sentence
3              swapcase
dtype: object
  
>>> s.str.upper()
0                 LOWER
1              CAPITALS
2    THIS IS A SENTENCE
3              SWAPCASE
dtype: object
  
>>> s.str.title()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: object
  
>>> s.str.capitalize()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: object
  
>>> s.str.swapcase()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: object
pandas.Series.str.translate   Series.str.translate(table)[source]
 
Map all characters in the string through the given mapping table. Equivalent to standard str.translate().  Parameters 
 
table:dict


Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or None. Unmapped characters are left untouched. Characters mapped to None are deleted. str.maketrans() is a helper function for making translation tables.    Returns 
 Series or Index
pandas.Series.str.upper   Series.str.upper()[source]
 
Convert strings in the Series/Index to uppercase. Equivalent to str.upper().  Returns 
 Series or Index of object
    See also  Series.str.lower

Converts all characters to lowercase.  Series.str.upper

Converts all characters to uppercase.  Series.str.title

Converts first character of each word to uppercase and remaining to lowercase.  Series.str.capitalize

Converts first character to uppercase and remaining to lowercase.  Series.str.swapcase

Converts uppercase to lowercase and lowercase to uppercase.  Series.str.casefold

Removes all case distinctions in the string.    Examples 
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s
0                 lower
1              CAPITALS
2    this is a sentence
3              SwApCaSe
dtype: object
  
>>> s.str.lower()
0                 lower
1              capitals
2    this is a sentence
3              swapcase
dtype: object
  
>>> s.str.upper()
0                 LOWER
1              CAPITALS
2    THIS IS A SENTENCE
3              SWAPCASE
dtype: object
  
>>> s.str.title()
0                 Lower
1              Capitals
2    This Is A Sentence
3              Swapcase
dtype: object
  
>>> s.str.capitalize()
0                 Lower
1              Capitals
2    This is a sentence
3              Swapcase
dtype: object
  
>>> s.str.swapcase()
0                 LOWER
1              capitals
2    THIS IS A SENTENCE
3              sWaPcAsE
dtype: object
pandas.Series.str.wrap   Series.str.wrap(width, **kwargs)[source]
 
Wrap strings in Series/Index at specified line width. This method has the same keyword parameters and defaults as textwrap.TextWrapper.  Parameters 
 
width:int


Maximum line width.  
expand_tabs:bool, optional


If True, tab characters will be expanded to spaces (default: True).  
replace_whitespace:bool, optional


If True, each whitespace character (as defined by string.whitespace) remaining after tab expansion will be replaced by a single space (default: True).  
drop_whitespace:bool, optional


If True, whitespace that, after wrapping, happens to end up at the beginning or end of a line is dropped (default: True).  
break_long_words:bool, optional


If True, then words longer than width will be broken in order to ensure that no lines are longer than width. If it is false, long words will not be broken, and some lines may be longer than width (default: True).  
break_on_hyphens:bool, optional


If True, wrapping will occur preferably on whitespace and right after hyphens in compound words, as it is customary in English. If false, only whitespaces will be considered as potentially good places for line breaks, but you need to set break_long_words to false if you want truly insecable words (default: True).    Returns 
 Series or Index
   Notes Internally, this method uses a textwrap.TextWrapper instance with default settings. To achieve behavior matching R’s stringr library str_wrap function, use the arguments:  expand_tabs = False replace_whitespace = True drop_whitespace = True break_long_words = False break_on_hyphens = False  Examples 
>>> s = pd.Series(['line to be wrapped', 'another line to be wrapped'])
>>> s.str.wrap(12)
0             line to be\nwrapped
1    another line\nto be\nwrapped
dtype: object
pandas.Series.str.zfill   Series.str.zfill(width)[source]
 
Pad strings in the Series/Index by prepending ‘0’ characters. Strings in the Series/Index are padded with ‘0’ characters on the left of the string to reach a total string length width. Strings in the Series/Index with length greater or equal to width are unchanged.  Parameters 
 
width:int


Minimum length of resulting string; strings with length less than width be prepended with ‘0’ characters.    Returns 
 Series/Index of objects.
    See also  Series.str.rjust

Fills the left side of strings with an arbitrary character.  Series.str.ljust

Fills the right side of strings with an arbitrary character.  Series.str.pad

Fills the specified sides of strings with an arbitrary character.  Series.str.center

Fills both sides of strings with an arbitrary character.    Notes Differs from str.zfill() which has special handling for ‘+’/’-’ in the string. Examples 
>>> s = pd.Series(['-1', '1', '1000', 10, np.nan])
>>> s
0      -1
1       1
2    1000
3      10
4     NaN
dtype: object
  Note that 10 and NaN are not strings, therefore they are converted to NaN. The minus sign in '-1' is treated as a regular character and the zero is added to the left of it (str.zfill() would have moved it to the left). 1000 remains unchanged as it is longer than width. 
>>> s.str.zfill(3)
0     0-1
1     001
2    1000
3     NaN
4     NaN
dtype: object
pandas.Series.sub   Series.sub(other, level=None, fill_value=None, axis=0)[source]
 
Return Subtraction of series and other, element-wise (binary operator sub). Equivalent to series - other, but with support to substitute a fill_value for missing data in either one of the inputs.  Parameters 
 
other:Series or scalar value


fill_value:None or float value, default None (NaN)


Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.  
level:int or name


Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns 
 Series

The result of the operation.      See also  Series.rsub

Reverse of the Subtraction operator, see Python documentation for more details.    Examples 
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.subtract(b, fill_value=0)
a    0.0
b    1.0
c    1.0
d   -1.0
e    NaN
dtype: float64