neulab/docprompting-conala huggingface dataset:
pandas.Series.mask   Series.mask(cond, other=nan, inplace=False, axis=None, level=None, errors=NoDefault.no_default, try_cast=NoDefault.no_default)[source]
 
Replace values where the condition is True.  Parameters 
 
cond:bool Series/DataFrame, array-like, or callable


Where cond is False, keep the original value. Where True, replace with corresponding value from other. If cond is callable, it is computed on the Series/DataFrame and should return boolean Series/DataFrame or array. The callable must not change input Series/DataFrame (though pandas doesn’t check it).  
other:scalar, Series/DataFrame, or callable


Entries where cond is True are replaced with corresponding value from other. If other is callable, it is computed on the Series/DataFrame and should return scalar or Series/DataFrame. The callable must not change input Series/DataFrame (though pandas doesn’t check it).  
inplace:bool, default False


Whether to perform the operation in place on the data.  
axis:int, default None


Alignment axis if needed.  
level:int, default None


Alignment level if needed.  
errors:str, {‘raise’, ‘ignore’}, default ‘raise’


Note that currently this parameter won’t affect the results and will always coerce to a suitable dtype.  ‘raise’ : allow exceptions to be raised. ‘ignore’ : suppress exceptions. On error return original object.   
try_cast:bool, default None


Try to cast the result back to the input type (if possible).  Deprecated since version 1.3.0: Manually cast back if necessary.     Returns 
 Same type as caller or None if inplace=True.
    See also  DataFrame.where()

Return an object of same shape as self.    Notes The mask method is an application of the if-then idiom. For each element in the calling DataFrame, if cond is False the element is used; otherwise the corresponding element from the DataFrame other is used. The signature for DataFrame.where() differs from numpy.where(). Roughly df1.where(m, df2) is equivalent to np.where(m, df1, df2). For further details and examples see the mask documentation in indexing. Examples 
>>> s = pd.Series(range(5))
>>> s.where(s > 0)
0    NaN
1    1.0
2    2.0
3    3.0
4    4.0
dtype: float64
>>> s.mask(s > 0)
0    0.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64
  
>>> s.where(s > 1, 10)
0    10
1    10
2    2
3    3
4    4
dtype: int64
>>> s.mask(s > 1, 10)
0     0
1     1
2    10
3    10
4    10
dtype: int64
  
>>> df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['A', 'B'])
>>> df
   A  B
0  0  1
1  2  3
2  4  5
3  6  7
4  8  9
>>> m = df % 3 == 0
>>> df.where(m, -df)
   A  B
0  0 -1
1 -2  3
2 -4 -5
3  6 -7
4 -8  9
>>> df.where(m, -df) == np.where(m, df, -df)
      A     B
0  True  True
1  True  True
2  True  True
3  True  True
4  True  True
>>> df.where(m, -df) == df.mask(~m, -df)
      A     B
0  True  True
1  True  True
2  True  True
3  True  True
4  True  True
pandas.Series.max   Series.max(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return the maximum of the values over the requested axis. If you want the index of the maximum, use idxmax. This is the equivalent of the numpy.ndarray method argmax.  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)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples 
>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64
  
>>> s.max()
8
pandas.Series.mean   Series.mean(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return the mean of the values over the requested axis.  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.median   Series.median(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return the median of the values over the requested axis.  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.memory_usage   Series.memory_usage(index=True, deep=False)[source]
 
Return the memory usage of the Series. The memory usage can optionally include the contribution of the index and of elements of object dtype.  Parameters 
 
index:bool, default True


Specifies whether to include the memory usage of the Series index.  
deep:bool, default False


If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned value.    Returns 
 int

Bytes of memory consumed.      See also  numpy.ndarray.nbytes

Total bytes consumed by the elements of the array.  DataFrame.memory_usage

Bytes consumed by a DataFrame.    Examples 
>>> s = pd.Series(range(3))
>>> s.memory_usage()
152
  Not including the index gives the size of the rest of the data, which is necessarily smaller: 
>>> s.memory_usage(index=False)
24
  The memory footprint of object values is ignored by default: 
>>> s = pd.Series(["a", "b"])
>>> s.values
array(['a', 'b'], dtype=object)
>>> s.memory_usage()
144
>>> s.memory_usage(deep=True)
244
pandas.Series.min   Series.min(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return the minimum of the values over the requested axis. If you want the index of the minimum, use idxmin. This is the equivalent of the numpy.ndarray method argmin.  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)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples 
>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64
  
>>> s.min()
0
pandas.Series.mod   Series.mod(other, level=None, fill_value=None, axis=0)[source]
 
Return Modulo of series and other, element-wise (binary operator mod). 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.rmod

Reverse of the Modulo 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.mod(b, fill_value=0)
a    0.0
b    NaN
c    NaN
d    0.0
e    NaN
dtype: float64
pandas.Series.mode   Series.mode(dropna=True)[source]
 
Return the mode(s) of the Series. The mode is the value that appears most often. There can be multiple modes. Always returns Series even if only one value is returned.  Parameters 
 
dropna:bool, default True


Don’t consider counts of NaN/NaT.    Returns 
 Series

Modes of the Series in sorted order.
pandas.Series.mul   Series.mul(other, level=None, fill_value=None, axis=0)[source]
 
Return Multiplication of series and other, element-wise (binary operator mul). 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.rmul

Reverse of the Multiplication 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.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64
pandas.Series.multiply   Series.multiply(other, level=None, fill_value=None, axis=0)[source]
 
Return Multiplication of series and other, element-wise (binary operator mul). 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.rmul

Reverse of the Multiplication 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.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64
pandas.Series.name   propertySeries.name
 
Return the name of the Series. The name of a Series becomes its index or column name if it is used to form a DataFrame. It is also used whenever displaying the Series using the interpreter.  Returns 
 label (hashable object)

The name of the Series, also the column name if part of a DataFrame.      See also  Series.rename

Sets the Series name when given a scalar input.  Index.name

Corresponding Index property.    Examples The Series name can be set initially when calling the constructor. 
>>> s = pd.Series([1, 2, 3], dtype=np.int64, name='Numbers')
>>> s
0    1
1    2
2    3
Name: Numbers, dtype: int64
>>> s.name = "Integers"
>>> s
0    1
1    2
2    3
Name: Integers, dtype: int64
  The name of a Series within a DataFrame is its column name. 
>>> df = pd.DataFrame([[1, 2], [3, 4], [5, 6]],
...                   columns=["Odd Numbers", "Even Numbers"])
>>> df
   Odd Numbers  Even Numbers
0            1             2
1            3             4
2            5             6
>>> df["Even Numbers"].name
'Even Numbers'
pandas.Series.nbytes   propertySeries.nbytes
 
Return the number of bytes in the underlying data.
pandas.Series.ndim   propertySeries.ndim
 
Number of dimensions of the underlying data, by definition 1.
pandas.Series.ne   Series.ne(other, level=None, fill_value=None, axis=0)[source]
 
Return Not equal to of series and other, element-wise (binary operator ne). 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.     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.ne(b, fill_value=0)
a    False
b     True
c     True
d     True
e     True
dtype: bool
pandas.Series.nlargest   Series.nlargest(n=5, keep='first')[source]
 
Return the largest n elements.  Parameters 
 
n:int, default 5


Return this many descending sorted values.  
keep:{‘first’, ‘last’, ‘all’}, default ‘first’


When there are duplicate values that cannot all fit in a Series of n elements:  first : return the first n occurrences in order of appearance. last : return the last n occurrences in reverse order of appearance. all : keep all occurrences. This can result in a Series of size larger than n.     Returns 
 Series

The n largest values in the Series, sorted in decreasing order.      See also  Series.nsmallest

Get the n smallest elements.  Series.sort_values

Sort Series by values.  Series.head

Return the first n rows.    Notes Faster than .sort_values(ascending=False).head(n) for small n relative to the size of the Series object. Examples 
>>> countries_population = {"Italy": 59000000, "France": 65000000,
...                         "Malta": 434000, "Maldives": 434000,
...                         "Brunei": 434000, "Iceland": 337000,
...                         "Nauru": 11300, "Tuvalu": 11300,
...                         "Anguilla": 11300, "Montserrat": 5200}
>>> s = pd.Series(countries_population)
>>> s
Italy       59000000
France      65000000
Malta         434000
Maldives      434000
Brunei        434000
Iceland       337000
Nauru          11300
Tuvalu         11300
Anguilla       11300
Montserrat      5200
dtype: int64
  The n largest elements where n=5 by default. 
>>> s.nlargest()
France      65000000
Italy       59000000
Malta         434000
Maldives      434000
Brunei        434000
dtype: int64
  The n largest elements where n=3. Default keep value is ‘first’ so Malta will be kept. 
>>> s.nlargest(3)
France    65000000
Italy     59000000
Malta       434000
dtype: int64
  The n largest elements where n=3 and keeping the last duplicates. Brunei will be kept since it is the last with value 434000 based on the index order. 
>>> s.nlargest(3, keep='last')
France      65000000
Italy       59000000
Brunei        434000
dtype: int64
  The n largest elements where n=3 with all duplicates kept. Note that the returned Series has five elements due to the three duplicates. 
>>> s.nlargest(3, keep='all')
France      65000000
Italy       59000000
Malta         434000
Maldives      434000
Brunei        434000
dtype: int64
pandas.Series.notna   Series.notna()[source]
 
Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.  Returns 
 Series

Mask of bool values for each element in Series that indicates whether an element is not an NA value.      See also  Series.notnull

Alias of notna.  Series.isna

Boolean inverse of notna.  Series.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA. 
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker
  
>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.notna()
0     True
1     True
2    False
dtype: bool
pandas.Series.notnull   Series.notnull()[source]
 
Series.notnull is an alias for Series.notna. Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.  Returns 
 Series

Mask of bool values for each element in Series that indicates whether an element is not an NA value.      See also  Series.notnull

Alias of notna.  Series.isna

Boolean inverse of notna.  Series.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA. 
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker
  
>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.notna()
0     True
1     True
2    False
dtype: bool
pandas.Series.nsmallest   Series.nsmallest(n=5, keep='first')[source]
 
Return the smallest n elements.  Parameters 
 
n:int, default 5


Return this many ascending sorted values.  
keep:{‘first’, ‘last’, ‘all’}, default ‘first’


When there are duplicate values that cannot all fit in a Series of n elements:  first : return the first n occurrences in order of appearance. last : return the last n occurrences in reverse order of appearance. all : keep all occurrences. This can result in a Series of size larger than n.     Returns 
 Series

The n smallest values in the Series, sorted in increasing order.      See also  Series.nlargest

Get the n largest elements.  Series.sort_values

Sort Series by values.  Series.head

Return the first n rows.    Notes Faster than .sort_values().head(n) for small n relative to the size of the Series object. Examples 
>>> countries_population = {"Italy": 59000000, "France": 65000000,
...                         "Brunei": 434000, "Malta": 434000,
...                         "Maldives": 434000, "Iceland": 337000,
...                         "Nauru": 11300, "Tuvalu": 11300,
...                         "Anguilla": 11300, "Montserrat": 5200}
>>> s = pd.Series(countries_population)
>>> s
Italy       59000000
France      65000000
Brunei        434000
Malta         434000
Maldives      434000
Iceland       337000
Nauru          11300
Tuvalu         11300
Anguilla       11300
Montserrat      5200
dtype: int64
  The n smallest elements where n=5 by default. 
>>> s.nsmallest()
Montserrat    5200
Nauru        11300
Tuvalu       11300
Anguilla     11300
Iceland     337000
dtype: int64
  The n smallest elements where n=3. Default keep value is ‘first’ so Nauru and Tuvalu will be kept. 
>>> s.nsmallest(3)
Montserrat   5200
Nauru       11300
Tuvalu      11300
dtype: int64
  The n smallest elements where n=3 and keeping the last duplicates. Anguilla and Tuvalu will be kept since they are the last with value 11300 based on the index order. 
>>> s.nsmallest(3, keep='last')
Montserrat   5200
Anguilla    11300
Tuvalu      11300
dtype: int64
  The n smallest elements where n=3 with all duplicates kept. Note that the returned Series has four elements due to the three duplicates. 
>>> s.nsmallest(3, keep='all')
Montserrat   5200
Nauru       11300
Tuvalu      11300
Anguilla    11300
dtype: int64
pandas.Series.nunique   Series.nunique(dropna=True)[source]
 
Return number of unique elements in the object. Excludes NA values by default.  Parameters 
 
dropna:bool, default True


Don’t include NaN in the count.    Returns 
 int
    See also  DataFrame.nunique

Method nunique for DataFrame.  Series.count

Count non-NA/null observations in the Series.    Examples 
>>> s = pd.Series([1, 3, 5, 7, 7])
>>> s
0    1
1    3
2    5
3    7
4    7
dtype: int64
  
>>> s.nunique()
4
pandas.Series.pad   Series.pad(axis=None, inplace=False, limit=None, downcast=None)[source]
 
Synonym for DataFrame.fillna() with method='ffill'.  Returns 
 Series/DataFrame or None

Object with missing values filled or None if inplace=True.