neulab/docprompting-conala huggingface dataset:
pandas.Series.searchsorted   Series.searchsorted(value, side='left', sorter=None)[source]
 
Find indices where elements should be inserted to maintain order. Find the indices into a sorted Series self such that, if the corresponding elements in value were inserted before the indices, the order of self would be preserved.  Note The Series must be monotonically sorted, otherwise wrong locations will likely be returned. Pandas does not check this for you.   Parameters 
 
value:array-like or scalar


Values to insert into self.  
side:{‘left’, ‘right’}, optional


If ‘left’, the index of the first suitable location found is given. If ‘right’, return the last such index. If there is no suitable index, return either 0 or N (where N is the length of self).  
sorter:1-D array-like, optional


Optional array of integer indices that sort self into ascending order. They are typically the result of np.argsort.    Returns 
 int or array of int

A scalar or array of insertion points with the same shape as value.      See also  sort_values

Sort by the values along either axis.  numpy.searchsorted

Similar method from NumPy.    Notes Binary search is used to find the required insertion points. Examples 
>>> ser = pd.Series([1, 2, 3])
>>> ser
0    1
1    2
2    3
dtype: int64
  
>>> ser.searchsorted(4)
3
  
>>> ser.searchsorted([0, 4])
array([0, 3])
  
>>> ser.searchsorted([1, 3], side='left')
array([0, 2])
  
>>> ser.searchsorted([1, 3], side='right')
array([1, 3])
  
>>> ser = pd.Series(pd.to_datetime(['3/11/2000', '3/12/2000', '3/13/2000']))
>>> ser
0   2000-03-11
1   2000-03-12
2   2000-03-13
dtype: datetime64[ns]
  
>>> ser.searchsorted('3/14/2000')
3
  
>>> ser = pd.Categorical(
...     ['apple', 'bread', 'bread', 'cheese', 'milk'], ordered=True
... )
>>> ser
['apple', 'bread', 'bread', 'cheese', 'milk']
Categories (4, object): ['apple' < 'bread' < 'cheese' < 'milk']
  
>>> ser.searchsorted('bread')
1
  
>>> ser.searchsorted(['bread'], side='right')
array([3])
  If the values are not monotonically sorted, wrong locations may be returned: 
>>> ser = pd.Series([2, 1, 3])
>>> ser
0    2
1    1
2    3
dtype: int64
  
>>> ser.searchsorted(1)  
0  # wrong result, correct would be 1
pandas.Series.sem   Series.sem(axis=None, skipna=True, level=None, ddof=1, numeric_only=None, **kwargs)[source]
 
Return unbiased standard error of the mean over requested axis. Normalized by N-1 by default. This can be changed using the ddof argument  Parameters 
 
axis:{index (0)}


skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.  
ddof:int, default 1


Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.  
numeric_only:bool, default None


Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.    Returns 
 scalar or Series (if level specified)
pandas.Series.set_axis   Series.set_axis(labels, axis=0, inplace=False)[source]
 
Assign desired index to given axis. Indexes for row labels can be changed by assigning a list-like or Index.  Parameters 
 
labels:list-like, Index


The values for the new index.  
axis:{0 or ‘index’}, default 0


The axis to update. The value 0 identifies the rows.  
inplace:bool, default False


Whether to return a new Series instance.    Returns 
 
renamed:Series or None


An object of type Series or None if inplace=True.      See also  Series.rename_axis

Alter the name of the index.    Examples 
>>> s = pd.Series([1, 2, 3])
>>> s
0    1
1    2
2    3
dtype: int64
  
>>> s.set_axis(['a', 'b', 'c'], axis=0)
a    1
b    2
c    3
dtype: int64
pandas.Series.set_flags   Series.set_flags(*, copy=False, allows_duplicate_labels=None)[source]
 
Return a new object with updated flags.  Parameters 
 
allows_duplicate_labels:bool, optional


Whether the returned object allows duplicate labels.    Returns 
 Series or DataFrame

The same type as the caller.      See also  DataFrame.attrs

Global metadata applying to this dataset.  DataFrame.flags

Global flags applying to this object.    Notes This method returns a new object that’s a view on the same data as the input. Mutating the input or the output values will be reflected in the other. This method is intended to be used in method chains. “Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs. Examples 
>>> df = pd.DataFrame({"A": [1, 2]})
>>> df.flags.allows_duplicate_labels
True
>>> df2 = df.set_flags(allows_duplicate_labels=False)
>>> df2.flags.allows_duplicate_labels
False
pandas.Series.shape   propertySeries.shape
 
Return a tuple of the shape of the underlying data.
pandas.Series.size   propertySeries.size
 
Return the number of elements in the underlying data.
pandas.Series.skew   Series.skew(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return unbiased skew over requested axis. Normalized by N-1.  Parameters 
 
axis:{index (0)}


Axis for the function to be applied on.  
skipna:bool, default True


Exclude NA/null values when computing the result.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.  
numeric_only:bool, default None


Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns 
 scalar or Series (if level specified)
pandas.Series.slice_shift   Series.slice_shift(periods=1, axis=0)[source]
 
Equivalent to shift without copying data. The shifted data will not include the dropped periods and the shifted axis will be smaller than the original.  Deprecated since version 1.2.0: slice_shift is deprecated, use DataFrame/Series.shift instead.   Parameters 
 
periods:int


Number of periods to move, can be positive or negative.    Returns 
 
shifted:same type as caller

   Notes While the slice_shift is faster than shift, you may pay for it later during alignment.
pandas.Series.sparse   Series.sparse()[source]
 
Accessor for SparseSparse from other sparse matrix data types.
pandas.Series.sparse.density   Series.sparse.density
 
The percent of non- fill_value points, as decimal. Examples 
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.density
0.6
pandas.Series.sparse.fill_value   Series.sparse.fill_value
 
Elements in data that are fill_value are not stored. For memory savings, this should be the most common value in the array.
pandas.Series.sparse.from_coo   classmethodSeries.sparse.from_coo(A, dense_index=False)[source]
 
Create a Series with sparse values from a scipy.sparse.coo_matrix.  Parameters 
 
A:scipy.sparse.coo_matrix


dense_index:bool, default False


If False (default), the SparseSeries index consists of only the coords of the non-null entries of the original coo_matrix. If True, the SparseSeries index consists of the full sorted (row, col) coordinates of the coo_matrix.    Returns 
 
s:Series


A Series with sparse values.     Examples 
>>> from scipy import sparse
  
>>> A = sparse.coo_matrix(
...     ([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), shape=(3, 4)
... )
>>> A
<3x4 sparse matrix of type '<class 'numpy.float64'>'
with 3 stored elements in COOrdinate format>
  
>>> A.todense()
matrix([[0., 0., 1., 2.],
[3., 0., 0., 0.],
[0., 0., 0., 0.]])
  
>>> ss = pd.Series.sparse.from_coo(A)
>>> ss
0  2    1.0
   3    2.0
1  0    3.0
dtype: Sparse[float64, nan]
pandas.Series.sparse.npoints   Series.sparse.npoints
 
The number of non- fill_value points. Examples 
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.npoints
3
pandas.Series.sparse.sp_values   Series.sparse.sp_values
 
An ndarray containing the non- fill_value values. Examples 
>>> s = SparseArray([0, 0, 1, 0, 2], fill_value=0)
>>> s.sp_values
array([1, 2])
pandas.Series.sparse.to_coo   Series.sparse.to_coo(row_levels=(0,), column_levels=(1,), sort_labels=False)[source]
 
Create a scipy.sparse.coo_matrix from a Series with MultiIndex. Use row_levels and column_levels to determine the row and column coordinates respectively. row_levels and column_levels are the names (labels) or numbers of the levels. {row_levels, column_levels} must be a partition of the MultiIndex level names (or numbers).  Parameters 
 
row_levels:tuple/list


column_levels:tuple/list


sort_labels:bool, default False


Sort the row and column labels before forming the sparse matrix. When row_levels and/or column_levels refer to a single level, set to True for a faster execution.    Returns 
 
y:scipy.sparse.coo_matrix


rows:list (row labels)


columns:list (column labels)

   Examples 
>>> s = pd.Series([3.0, np.nan, 1.0, 3.0, np.nan, np.nan])
>>> s.index = pd.MultiIndex.from_tuples(
...     [
...         (1, 2, "a", 0),
...         (1, 2, "a", 1),
...         (1, 1, "b", 0),
...         (1, 1, "b", 1),
...         (2, 1, "b", 0),
...         (2, 1, "b", 1)
...     ],
...     names=["A", "B", "C", "D"],
... )
>>> s
A  B  C  D
1  2  a  0    3.0
         1    NaN
   1  b  0    1.0
         1    3.0
2  1  b  0    NaN
         1    NaN
dtype: float64
  
>>> ss = s.astype("Sparse")
>>> ss
A  B  C  D
1  2  a  0    3.0
         1    NaN
   1  b  0    1.0
         1    3.0
2  1  b  0    NaN
         1    NaN
dtype: Sparse[float64, nan]
  
>>> A, rows, columns = ss.sparse.to_coo(
...     row_levels=["A", "B"], column_levels=["C", "D"], sort_labels=True
... )
>>> A
<3x4 sparse matrix of type '<class 'numpy.float64'>'
with 3 stored elements in COOrdinate format>
>>> A.todense()
matrix([[0., 0., 1., 3.],
[3., 0., 0., 0.],
[0., 0., 0., 0.]])
  
>>> rows
[(1, 1), (1, 2), (2, 1)]
>>> columns
[('a', 0), ('a', 1), ('b', 0), ('b', 1)]
pandas.Series.squeeze   Series.squeeze(axis=None)[source]
 
Squeeze 1 dimensional axis objects into scalars. Series or DataFrames with a single element are squeezed to a scalar. DataFrames with a single column or a single row are squeezed to a Series. Otherwise the object is unchanged. This method is most useful when you don’t know if your object is a Series or DataFrame, but you do know it has just a single column. In that case you can safely call squeeze to ensure you have a Series.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’, None}, default None


A specific axis to squeeze. By default, all length-1 axes are squeezed.    Returns 
 DataFrame, Series, or scalar

The projection after squeezing axis or all the axes.      See also  Series.iloc

Integer-location based indexing for selecting scalars.  DataFrame.iloc

Integer-location based indexing for selecting Series.  Series.to_frame

Inverse of DataFrame.squeeze for a single-column DataFrame.    Examples 
>>> primes = pd.Series([2, 3, 5, 7])
  Slicing might produce a Series with a single value: 
>>> even_primes = primes[primes % 2 == 0]
>>> even_primes
0    2
dtype: int64
  
>>> even_primes.squeeze()
2
  Squeezing objects with more than one value in every axis does nothing: 
>>> odd_primes = primes[primes % 2 == 1]
>>> odd_primes
1    3
2    5
3    7
dtype: int64
  
>>> odd_primes.squeeze()
1    3
2    5
3    7
dtype: int64
  Squeezing is even more effective when used with DataFrames. 
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])
>>> df
   a  b
0  1  2
1  3  4
  Slicing a single column will produce a DataFrame with the columns having only one value: 
>>> df_a = df[['a']]
>>> df_a
   a
0  1
1  3
  So the columns can be squeezed down, resulting in a Series: 
>>> df_a.squeeze('columns')
0    1
1    3
Name: a, dtype: int64
  Slicing a single row from a single column will produce a single scalar DataFrame: 
>>> df_0a = df.loc[df.index < 1, ['a']]
>>> df_0a
   a
0  1
  Squeezing the rows produces a single scalar Series: 
>>> df_0a.squeeze('rows')
a    1
Name: 0, dtype: int64
  Squeezing all axes will project directly into a scalar: 
>>> df_0a.squeeze()
1
pandas.Series.std   Series.std(axis=None, skipna=True, level=None, ddof=1, numeric_only=None, **kwargs)[source]
 
Return sample standard deviation over requested axis. Normalized by N-1 by default. This can be changed using the ddof argument.  Parameters 
 
axis:{index (0)}


skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.  
ddof:int, default 1


Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.  
numeric_only:bool, default None


Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.    Returns 
 scalar or Series (if level specified)
   Notes To have the same behaviour as numpy.std, use ddof=0 (instead of the default ddof=1) Examples 
>>> df = pd.DataFrame({'person_id': [0, 1, 2, 3],
...                   'age': [21, 25, 62, 43],
...                   'height': [1.61, 1.87, 1.49, 2.01]}
...                  ).set_index('person_id')
>>> df
           age  height
person_id
0           21    1.61
1           25    1.87
2           62    1.49
3           43    2.01
  The standard deviation of the columns can be found as follows: 
>>> df.std()
age       18.786076
height     0.237417
  Alternatively, ddof=0 can be set to normalize by N instead of N-1: 
>>> df.std(ddof=0)
age       16.269219
height     0.205609
pandas.Series.str   Series.str()[source]
 
Vectorized string functions for Series and Index. NAs stay NA unless handled otherwise by a particular method. Patterned after Python’s string methods, with some inspiration from R’s stringr package. Examples 
>>> s = pd.Series(["A_Str_Series"])
>>> s
0    A_Str_Series
dtype: object
  
>>> s.str.split("_")
0    [A, Str, Series]
dtype: object
  
>>> s.str.replace("_", "")
0    AStrSeries
dtype: object
pandas.Series.str.capitalize   Series.str.capitalize()[source]
 
Convert strings in the Series/Index to be capitalized. Equivalent to str.capitalize().  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.casefold   Series.str.casefold()[source]
 
Convert strings in the Series/Index to be casefolded.  New in version 0.25.0.  Equivalent to str.casefold().  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.center   Series.str.center(width, fillchar=' ')[source]
 
Pad left and right side of strings in the Series/Index. Equivalent to str.center().  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.contains   Series.str.contains(pat, case=True, flags=0, na=None, regex=True)[source]
 
Test if pattern or regex is contained within a string of a Series or Index. Return boolean Series or Index based on whether a given pattern or regex is contained within a string of a Series or Index.  Parameters 
 
pat:str


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


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


Flags to pass through to the re module, 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.  
regex:bool, default True


If True, assumes the pat is a regular expression. If False, treats the pat as a literal string.    Returns 
 Series or Index of boolean values

A Series or Index of boolean values indicating whether the given pattern is contained within the string of each element of the Series or Index.      See also  match

Analogous, but stricter, relying on re.match instead of re.search.  Series.str.startswith

Test if the start of each string element matches a pattern.  Series.str.endswith

Same as startswith, but tests the end of string.    Examples Returning a Series of booleans using only a literal pattern. 
>>> s1 = pd.Series(['Mouse', 'dog', 'house and parrot', '23', np.NaN])
>>> s1.str.contains('og', regex=False)
0    False
1     True
2    False
3    False
4      NaN
dtype: object
  Returning an Index of booleans using only a literal pattern. 
>>> ind = pd.Index(['Mouse', 'dog', 'house and parrot', '23.0', np.NaN])
>>> ind.str.contains('23', regex=False)
Index([False, False, False, True, nan], dtype='object')
  Specifying case sensitivity using case. 
>>> s1.str.contains('oG', case=True, regex=True)
0    False
1    False
2    False
3    False
4      NaN
dtype: object
  Specifying na to be False instead of NaN replaces NaN values with False. If Series or Index does not contain NaN values the resultant dtype will be bool, otherwise, an object dtype. 
>>> s1.str.contains('og', na=False, regex=True)
0    False
1     True
2    False
3    False
4    False
dtype: bool
  Returning ‘house’ or ‘dog’ when either expression occurs in a string. 
>>> s1.str.contains('house|dog', regex=True)
0    False
1     True
2     True
3    False
4      NaN
dtype: object
  Ignoring case sensitivity using flags with regex. 
>>> import re
>>> s1.str.contains('PARROT', flags=re.IGNORECASE, regex=True)
0    False
1    False
2     True
3    False
4      NaN
dtype: object
  Returning any digit using regular expression. 
>>> s1.str.contains('\\d', regex=True)
0    False
1    False
2    False
3     True
4      NaN
dtype: object
  Ensure pat is a not a literal pattern when regex is set to True. Note in the following example one might expect only s2[1] and s2[3] to return True. However, ‘.0’ as a regex matches any character followed by a 0. 
>>> s2 = pd.Series(['40', '40.0', '41', '41.0', '35'])
>>> s2.str.contains('.0', regex=True)
0     True
1     True
2    False
3     True
4    False
dtype: bool
pandas.Series.str.count   Series.str.count(pat, flags=0)[source]
 
Count occurrences of pattern in each string of the Series/Index. This function is used to count the number of times a particular regex pattern is repeated in each of the string elements of the Series.  Parameters 
 
pat:str


Valid regular expression.  
flags:int, default 0, meaning no flags


Flags for the re module. For a complete list, see here.  **kwargs

For compatibility with other string methods. Not used.    Returns 
 Series or Index

Same type as the calling object containing the integer counts.      See also  re

Standard library module for regular expressions.  str.count

Standard library version, without regular expression support.    Notes Some characters need to be escaped when passing in pat. eg. '$' has a special meaning in regex and must be escaped when finding this literal character. Examples 
>>> s = pd.Series(['A', 'B', 'Aaba', 'Baca', np.nan, 'CABA', 'cat'])
>>> s.str.count('a')
0    0.0
1    0.0
2    2.0
3    2.0
4    NaN
5    0.0
6    1.0
dtype: float64
  Escape '$' to find the literal dollar sign. 
>>> s = pd.Series(['$', 'B', 'Aab$', '$$ca', 'C$B$', 'cat'])
>>> s.str.count('\\$')
0    1
1    0
2    1
3    2
4    2
5    0
dtype: int64
  This is also available on Index 
>>> pd.Index(['A', 'A', 'Aaba', 'cat']).str.count('a')
Int64Index([0, 0, 2, 1], dtype='int64')
pandas.Series.str.decode   Series.str.decode(encoding, errors='strict')[source]
 
Decode character string in the Series/Index using indicated encoding. Equivalent to str.decode() in python2 and bytes.decode() in python3.  Parameters 
 
encoding:str


errors:str, optional

  Returns 
 Series or Index
pandas.Series.str.encode   Series.str.encode(encoding, errors='strict')[source]
 
Encode character string in the Series/Index using indicated encoding. Equivalent to str.encode().  Parameters 
 
encoding:str


errors:str, optional

  Returns 
 
encoded:Series/Index of objects
pandas.Series.str.endswith   Series.str.endswith(pat, na=None)[source]
 
Test if the end of each string element matches a pattern. Equivalent to str.endswith().  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 end of each string element.      See also  str.endswith

Python standard library string method.  Series.str.startswith

Same as endswith, but tests the start 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.endswith('t')
0     True
1    False
2    False
3      NaN
dtype: object
  Specifying na to be False instead of NaN. 
>>> s.str.endswith('t', na=False)
0     True
1    False
2    False
3    False
dtype: bool