neulab/docprompting-conala huggingface dataset:
pandas.DataFrame.isin   DataFrame.isin(values)[source]
 
Whether each element in the DataFrame is contained in values.  Parameters 
 
values:iterable, Series, DataFrame or dict


The result will only be true at a location if all the labels match. If values is a Series, that’s the index. If values is a dict, the keys must be the column names, which must match. If values is a DataFrame, then both the index and column labels must match.    Returns 
 DataFrame

DataFrame of booleans showing whether each element in the DataFrame is contained in values.      See also  DataFrame.eq

Equality test for DataFrame.  Series.isin

Equivalent method on Series.  Series.str.contains

Test if pattern or regex is contained within a string of a Series or Index.    Examples 
>>> df = pd.DataFrame({'num_legs': [2, 4], 'num_wings': [2, 0]},
...                   index=['falcon', 'dog'])
>>> df
        num_legs  num_wings
falcon         2          2
dog            4          0
  When values is a list check whether every value in the DataFrame is present in the list (which animals have 0 or 2 legs or wings) 
>>> df.isin([0, 2])
        num_legs  num_wings
falcon      True       True
dog        False       True
  To check if values is not in the DataFrame, use the ~ operator: 
>>> ~df.isin([0, 2])
        num_legs  num_wings
falcon     False      False
dog         True      False
  When values is a dict, we can pass values to check for each column separately: 
>>> df.isin({'num_wings': [0, 3]})
        num_legs  num_wings
falcon     False      False
dog        False       True
  When values is a Series or DataFrame the index and column must match. Note that ‘falcon’ does not match based on the number of legs in other. 
>>> other = pd.DataFrame({'num_legs': [8, 3], 'num_wings': [0, 2]},
...                      index=['spider', 'falcon'])
>>> df.isin(other)
        num_legs  num_wings
falcon     False       True
dog        False      False
pandas.DataFrame.isna   DataFrame.isna()[source]
 
Detect missing values. Return a boolean same-sized object indicating if the values are NA. NA values, such as None or numpy.NaN, gets mapped to True values. Everything else gets mapped to False values. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True).  Returns 
 DataFrame

Mask of bool values for each element in DataFrame that indicates whether an element is an NA value.      See also  DataFrame.isnull

Alias of isna.  DataFrame.notna

Boolean inverse of isna.  DataFrame.dropna

Omit axes labels with missing values.  isna

Top-level isna.    Examples Show which entries in a DataFrame are 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.isna()
     age   born   name    toy
0  False   True  False   True
1  False  False  False  False
2   True  False  False  False
  Show which entries in a Series are NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.isna()
0    False
1    False
2     True
dtype: bool
pandas.DataFrame.isnull   DataFrame.isnull()[source]
 
DataFrame.isnull is an alias for DataFrame.isna. Detect missing values. Return a boolean same-sized object indicating if the values are NA. NA values, such as None or numpy.NaN, gets mapped to True values. Everything else gets mapped to False values. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True).  Returns 
 DataFrame

Mask of bool values for each element in DataFrame that indicates whether an element is an NA value.      See also  DataFrame.isnull

Alias of isna.  DataFrame.notna

Boolean inverse of isna.  DataFrame.dropna

Omit axes labels with missing values.  isna

Top-level isna.    Examples Show which entries in a DataFrame are 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.isna()
     age   born   name    toy
0  False   True  False   True
1  False  False  False  False
2   True  False  False  False
  Show which entries in a Series are NA. 
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64
  
>>> ser.isna()
0    False
1    False
2     True
dtype: bool
pandas.DataFrame.items   DataFrame.items()[source]
 
Iterate over (column name, Series) pairs. Iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.  Yields 
 
label:object


The column names for the DataFrame being iterated over.  
content:Series


The column entries belonging to each label, as a Series.      See also  DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.  DataFrame.itertuples

Iterate over DataFrame rows as namedtuples of the values.    Examples 
>>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
...                   'population': [1864, 22000, 80000]},
...                   index=['panda', 'polar', 'koala'])
>>> df
        species   population
panda   bear      1864
polar   bear      22000
koala   marsupial 80000
>>> for label, content in df.items():
...     print(f'label: {label}')
...     print(f'content: {content}', sep='\n')
...
label: species
content:
panda         bear
polar         bear
koala    marsupial
Name: species, dtype: object
label: population
content:
panda     1864
polar    22000
koala    80000
Name: population, dtype: int64
pandas.DataFrame.iteritems   DataFrame.iteritems()[source]
 
Iterate over (column name, Series) pairs. Iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.  Yields 
 
label:object


The column names for the DataFrame being iterated over.  
content:Series


The column entries belonging to each label, as a Series.      See also  DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.  DataFrame.itertuples

Iterate over DataFrame rows as namedtuples of the values.    Examples 
>>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
...                   'population': [1864, 22000, 80000]},
...                   index=['panda', 'polar', 'koala'])
>>> df
        species   population
panda   bear      1864
polar   bear      22000
koala   marsupial 80000
>>> for label, content in df.items():
...     print(f'label: {label}')
...     print(f'content: {content}', sep='\n')
...
label: species
content:
panda         bear
polar         bear
koala    marsupial
Name: species, dtype: object
label: population
content:
panda     1864
polar    22000
koala    80000
Name: population, dtype: int64
pandas.DataFrame.iterrows   DataFrame.iterrows()[source]
 
Iterate over DataFrame rows as (index, Series) pairs.  Yields 
 
index:label or tuple of label


The index of the row. A tuple for a MultiIndex.  
data:Series


The data of the row as a Series.      See also  DataFrame.itertuples

Iterate over DataFrame rows as namedtuples of the values.  DataFrame.items

Iterate over (column name, Series) pairs.    Notes  
Because iterrows returns a Series for each row, it does not preserve dtypes across the rows (dtypes are preserved across columns for DataFrames). For example, 
>>> df = pd.DataFrame([[1, 1.5]], columns=['int', 'float'])
>>> row = next(df.iterrows())[1]
>>> row
int      1.0
float    1.5
Name: 0, dtype: float64
>>> print(row['int'].dtype)
float64
>>> print(df['int'].dtype)
int64
  To preserve dtypes while iterating over the rows, it is better to use itertuples() which returns namedtuples of the values and which is generally faster than iterrows.  You should never modify something you are iterating over. This is not guaranteed to work in all cases. Depending on the data types, the iterator returns a copy and not a view, and writing to it will have no effect.
pandas.DataFrame.itertuples   DataFrame.itertuples(index=True, name='Pandas')[source]
 
Iterate over DataFrame rows as namedtuples.  Parameters 
 
index:bool, default True


If True, return the index as the first element of the tuple.  
name:str or None, default “Pandas”


The name of the returned namedtuples or None to return regular tuples.    Returns 
 iterator

An object to iterate over namedtuples for each row in the DataFrame with the first field possibly being the index and following fields being the column values.      See also  DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.  DataFrame.items

Iterate over (column name, Series) pairs.    Notes The column names will be renamed to positional names if they are invalid Python identifiers, repeated, or start with an underscore. On python versions < 3.7 regular tuples are returned for DataFrames with a large number of columns (>254). Examples 
>>> df = pd.DataFrame({'num_legs': [4, 2], 'num_wings': [0, 2]},
...                   index=['dog', 'hawk'])
>>> df
      num_legs  num_wings
dog          4          0
hawk         2          2
>>> for row in df.itertuples():
...     print(row)
...
Pandas(Index='dog', num_legs=4, num_wings=0)
Pandas(Index='hawk', num_legs=2, num_wings=2)
  By setting the index parameter to False we can remove the index as the first element of the tuple: 
>>> for row in df.itertuples(index=False):
...     print(row)
...
Pandas(num_legs=4, num_wings=0)
Pandas(num_legs=2, num_wings=2)
  With the name parameter set we set a custom name for the yielded namedtuples: 
>>> for row in df.itertuples(name='Animal'):
...     print(row)
...
Animal(Index='dog', num_legs=4, num_wings=0)
Animal(Index='hawk', num_legs=2, num_wings=2)
pandas.DataFrame.keys   DataFrame.keys()[source]
 
Get the ‘info axis’ (see Indexing for more). This is index for Series, columns for DataFrame.  Returns 
 Index

Info axis.
pandas.DataFrame.kurt   DataFrame.kurt(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return unbiased kurtosis over requested axis. Kurtosis obtained using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). Normalized by N-1.  Parameters 
 
axis:{index (0), columns (1)}


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 Series.  
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 
 Series or DataFrame (if level specified)
pandas.DataFrame.kurtosis   DataFrame.kurtosis(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]
 
Return unbiased kurtosis over requested axis. Kurtosis obtained using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). Normalized by N-1.  Parameters 
 
axis:{index (0), columns (1)}


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 Series.  
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 
 Series or DataFrame (if level specified)
pandas.DataFrame.last   DataFrame.last(offset)[source]
 
Select final periods of time series data based on a date offset. For a DataFrame with a sorted DatetimeIndex, this function selects the last few rows based on a date offset.  Parameters 
 
offset:str, DateOffset, dateutil.relativedelta


The offset length of the data that will be selected. For instance, ‘3D’ will display all the rows having their index within the last 3 days.    Returns 
 Series or DataFrame

A subset of the caller.    Raises 
 TypeError

If the index is not a DatetimeIndex      See also  first

Select initial periods of time series based on a date offset.  at_time

Select values at a particular time of the day.  between_time

Select values between particular times of the day.    Examples 
>>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
            A
2018-04-09  1
2018-04-11  2
2018-04-13  3
2018-04-15  4
  Get the rows for the last 3 days: 
>>> ts.last('3D')
            A
2018-04-13  3
2018-04-15  4
  Notice the data for 3 last calendar days were returned, not the last 3 observed days in the dataset, and therefore data for 2018-04-11 was not returned.
pandas.DataFrame.last_valid_index   DataFrame.last_valid_index()[source]
 
Return index for last non-NA value or None, if no NA value is found.  Returns 
 
scalar:type of index

   Notes If all elements are non-NA/null, returns None. Also returns None for empty Series/DataFrame.
pandas.DataFrame.lookup   DataFrame.lookup(row_labels, col_labels)[source]
 
Label-based “fancy indexing” function for DataFrame. Given equal-length arrays of row and column labels, return an array of the values corresponding to each (row, col) pair.  Deprecated since version 1.2.0: DataFrame.lookup is deprecated, use DataFrame.melt and DataFrame.loc instead. For further details see Looking up values by index/column labels.   Parameters 
 
row_labels:sequence


The row labels to use for lookup.  
col_labels:sequence


The column labels to use for lookup.    Returns 
 numpy.ndarray

The found values.
pandas.DataFrame.mad   DataFrame.mad(axis=None, skipna=True, level=None)[source]
 
Return the mean absolute deviation of the values over the requested axis.  Parameters 
 
axis:{index (0), columns (1)}


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 Series.    Returns 
 Series or DataFrame (if level specified)
pandas.DataFrame.mask   DataFrame.mask(cond, other=nan, inplace=False, axis=None, level=None, errors='raise', 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.DataFrame.max   DataFrame.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), columns (1)}


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 Series.  
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 
 Series or DataFrame (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.DataFrame.mean   DataFrame.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), columns (1)}


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 Series.  
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 
 Series or DataFrame (if level specified)
pandas.DataFrame.median   DataFrame.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), columns (1)}


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 Series.  
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 
 Series or DataFrame (if level specified)
pandas.DataFrame.melt   DataFrame.melt(id_vars=None, value_vars=None, var_name=None, value_name='value', col_level=None, ignore_index=True)[source]
 
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. This function is useful to massage a DataFrame into a format where one or more columns are identifier variables (id_vars), while all other columns, considered measured variables (value_vars), are “unpivoted” to the row axis, leaving just two non-identifier columns, ‘variable’ and ‘value’.  Parameters 
 
id_vars:tuple, list, or ndarray, optional


Column(s) to use as identifier variables.  
value_vars:tuple, list, or ndarray, optional


Column(s) to unpivot. If not specified, uses all columns that are not set as id_vars.  
var_name:scalar


Name to use for the ‘variable’ column. If None it uses frame.columns.name or ‘variable’.  
value_name:scalar, default ‘value’


Name to use for the ‘value’ column.  
col_level:int or str, optional


If columns are a MultiIndex then use this level to melt.  
ignore_index:bool, default True


If True, original index is ignored. If False, the original index is retained. Index labels will be repeated as necessary.  New in version 1.1.0.     Returns 
 DataFrame

Unpivoted DataFrame.      See also  melt

Identical method.  pivot_table

Create a spreadsheet-style pivot table as a DataFrame.  DataFrame.pivot

Return reshaped DataFrame organized by given index / column values.  DataFrame.explode

Explode a DataFrame from list-like columns to long format.    Examples 
>>> df = pd.DataFrame({'A': {0: 'a', 1: 'b', 2: 'c'},
...                    'B': {0: 1, 1: 3, 2: 5},
...                    'C': {0: 2, 1: 4, 2: 6}})
>>> df
   A  B  C
0  a  1  2
1  b  3  4
2  c  5  6
  
>>> df.melt(id_vars=['A'], value_vars=['B'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
  
>>> df.melt(id_vars=['A'], value_vars=['B', 'C'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
3  a        C      2
4  b        C      4
5  c        C      6
  The names of ‘variable’ and ‘value’ columns can be customized: 
>>> df.melt(id_vars=['A'], value_vars=['B'],
...         var_name='myVarname', value_name='myValname')
   A myVarname  myValname
0  a         B          1
1  b         B          3
2  c         B          5
  Original index values can be kept around: 
>>> df.melt(id_vars=['A'], value_vars=['B', 'C'], ignore_index=False)
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
0  a        C      2
1  b        C      4
2  c        C      6
  If you have multi-index columns: 
>>> df.columns = [list('ABC'), list('DEF')]
>>> df
   A  B  C
   D  E  F
0  a  1  2
1  b  3  4
2  c  5  6
  
>>> df.melt(col_level=0, id_vars=['A'], value_vars=['B'])
   A variable  value
0  a        B      1
1  b        B      3
2  c        B      5
  
>>> df.melt(id_vars=[('A', 'D')], value_vars=[('B', 'E')])
  (A, D) variable_0 variable_1  value
0      a          B          E      1
1      b          B          E      3
2      c          B          E      5