neulab/docprompting-conala huggingface dataset:
pandas.CategoricalIndex.reorder_categories   CategoricalIndex.reorder_categories(*args, **kwargs)[source]
 
Reorder categories as specified in new_categories. new_categories need to include all old categories and no new category items.  Parameters 
 
new_categories:Index-like


The categories in new order.  
ordered:bool, optional


Whether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information.  
inplace:bool, default False


Whether or not to reorder the categories inplace or return a copy of this categorical with reordered categories.  Deprecated since version 1.3.0.     Returns 
 
cat:Categorical or None


Categorical with removed categories or None if inplace=True.    Raises 
 ValueError

If the new categories do not contain all old category items or any new ones      See also  rename_categories

Rename categories.  add_categories

Add new categories.  remove_categories

Remove the specified categories.  remove_unused_categories

Remove categories which are not used.  set_categories

Set the categories to the specified ones.
pandas.CategoricalIndex.set_categories   CategoricalIndex.set_categories(*args, **kwargs)[source]
 
Set the categories to the specified new_categories. new_categories can include new categories (which will result in unused categories) or remove old categories (which results in values set to NaN). If rename==True, the categories will simple be renamed (less or more items than in old categories will result in values set to NaN or in unused categories respectively). This method can be used to perform more than one action of adding, removing, and reordering simultaneously and is therefore faster than performing the individual steps via the more specialised methods. On the other hand this methods does not do checks (e.g., whether the old categories are included in the new categories on a reorder), which can result in surprising changes, for example when using special string dtypes, which does not considers a S1 string equal to a single char python string.  Parameters 
 
new_categories:Index-like


The categories in new order.  
ordered:bool, default False


Whether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information.  
rename:bool, default False


Whether or not the new_categories should be considered as a rename of the old categories or as reordered categories.  
inplace:bool, default False


Whether or not to reorder the categories in-place or return a copy of this categorical with reordered categories.  Deprecated since version 1.3.0.     Returns 
 Categorical with reordered categories or None if inplace.
  Raises 
 ValueError

If new_categories does not validate as categories      See also  rename_categories

Rename categories.  reorder_categories

Reorder categories.  add_categories

Add new categories.  remove_categories

Remove the specified categories.  remove_unused_categories

Remove categories which are not used.
pandas.core.groupby.DataFrameGroupBy.all   DataFrameGroupBy.all(skipna=True)[source]
 
Return True if all values in the group are truthful, else False.  Parameters 
 
skipna:bool, default True


Flag to ignore nan values during truth testing.    Returns 
 Series or DataFrame

DataFrame or Series of boolean values, where a value is True if all elements are True within its respective group, False otherwise.      See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.any   DataFrameGroupBy.any(skipna=True)[source]
 
Return True if any value in the group is truthful, else False.  Parameters 
 
skipna:bool, default True


Flag to ignore nan values during truth testing.    Returns 
 Series or DataFrame

DataFrame or Series of boolean values, where a value is True if any element is True within its respective group, False otherwise.      See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.backfill   DataFrameGroupBy.backfill(limit=None)[source]
 
Backward fill the values.  Parameters 
 
limit:int, optional


Limit of how many values to fill.    Returns 
 Series or DataFrame

Object with missing values filled.      See also  Series.bfill

Backward fill the missing values in the dataset.  DataFrame.bfill

Backward fill the missing values in the dataset.  Series.fillna

Fill NaN values of a Series.  DataFrame.fillna

Fill NaN values of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.bfill   DataFrameGroupBy.bfill(limit=None)[source]
 
Backward fill the values.  Parameters 
 
limit:int, optional


Limit of how many values to fill.    Returns 
 Series or DataFrame

Object with missing values filled.      See also  Series.bfill

Backward fill the missing values in the dataset.  DataFrame.bfill

Backward fill the missing values in the dataset.  Series.fillna

Fill NaN values of a Series.  DataFrame.fillna

Fill NaN values of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.boxplot   DataFrameGroupBy.boxplot(subplots=True, column=None, fontsize=None, rot=0, grid=True, ax=None, figsize=None, layout=None, sharex=False, sharey=True, backend=None, **kwargs)[source]
 
Make box plots from DataFrameGroupBy data.  Parameters 
 
grouped:Grouped DataFrame


subplots:bool


 False - no subplots will be used True - create a subplot for each group.   
column:column name or list of names, or vector


Can be any valid input to groupby.  
fontsize:int or str


rot:label rotation angle


grid:Setting this to True will show the grid


ax:Matplotlib axis object, default None


figsize:A tuple (width, height) in inches


layout:tuple (optional)


The layout of the plot: (rows, columns).  
sharex:bool, default False


Whether x-axes will be shared among subplots.  
sharey:bool, default True


Whether y-axes will be shared among subplots.  
backend:str, default None


Backend to use instead of the backend specified in the option plotting.backend. For instance, ‘matplotlib’. Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.  New in version 1.0.0.   **kwargs

All other plotting keyword arguments to be passed to matplotlib’s boxplot function.    Returns 
 dict of key/value = group key/DataFrame.boxplot return value
or DataFrame.boxplot return value in case subplots=figures=False
   Examples You can create boxplots for grouped data and show them as separate subplots: 
>>> import itertools
>>> tuples = [t for t in itertools.product(range(1000), range(4))]
>>> index = pd.MultiIndex.from_tuples(tuples, names=['lvl0', 'lvl1'])
>>> data = np.random.randn(len(index),4)
>>> df = pd.DataFrame(data, columns=list('ABCD'), index=index)
>>> grouped = df.groupby(level='lvl1')
>>> grouped.boxplot(rot=45, fontsize=12, figsize=(8,10))  
     The subplots=False option shows the boxplots in a single figure. 
>>> grouped.boxplot(subplots=False, rot=45, fontsize=12)
pandas.core.groupby.DataFrameGroupBy.corr   propertyDataFrameGroupBy.corr
 
Compute pairwise correlation of columns, excluding NA/null values.  Parameters 
 
method:{‘pearson’, ‘kendall’, ‘spearman’} or callable


Method of correlation:  pearson : standard correlation coefficient kendall : Kendall Tau correlation coefficient spearman : Spearman rank correlation 
 callable: callable with input two 1d ndarrays

and returning a float. Note that the returned matrix from corr will have 1 along the diagonals and will be symmetric regardless of the callable’s behavior.      
min_periods:int, optional


Minimum number of observations required per pair of columns to have a valid result. Currently only available for Pearson and Spearman correlation.    Returns 
 DataFrame

Correlation matrix.      See also  DataFrame.corrwith

Compute pairwise correlation with another DataFrame or Series.  Series.corr

Compute the correlation between two Series.    Examples 
>>> def histogram_intersection(a, b):
...     v = np.minimum(a, b).sum().round(decimals=1)
...     return v
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
...                   columns=['dogs', 'cats'])
>>> df.corr(method=histogram_intersection)
      dogs  cats
dogs   1.0   0.3
cats   0.3   1.0
pandas.core.groupby.DataFrameGroupBy.corrwith   propertyDataFrameGroupBy.corrwith
 
Compute pairwise correlation. Pairwise correlation is computed between rows or columns of DataFrame with rows or columns of Series or DataFrame. DataFrames are first aligned along both axes before computing the correlations.  Parameters 
 
other:DataFrame, Series


Object with which to compute correlations.  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to use. 0 or ‘index’ to compute column-wise, 1 or ‘columns’ for row-wise.  
drop:bool, default False


Drop missing indices from result.  
method:{‘pearson’, ‘kendall’, ‘spearman’} or callable


Method of correlation:  pearson : standard correlation coefficient kendall : Kendall Tau correlation coefficient spearman : Spearman rank correlation 
 callable: callable with input two 1d ndarrays

and returning a float.        Returns 
 Series

Pairwise correlations.      See also  DataFrame.corr

Compute pairwise correlation of columns.
pandas.core.groupby.DataFrameGroupBy.count   DataFrameGroupBy.count()[source]
 
Compute count of group, excluding missing values.  Returns 
 Series or DataFrame

Count of values within each group.      See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.cumcount   DataFrameGroupBy.cumcount(ascending=True)[source]
 
Number each item in each group from 0 to the length of that group - 1. Essentially this is equivalent to 
self.apply(lambda x: pd.Series(np.arange(len(x)), x.index))
   Parameters 
 
ascending:bool, default True


If False, number in reverse, from length of group - 1 to 0.    Returns 
 Series

Sequence number of each element within each group.      See also  ngroup

Number the groups themselves.    Examples 
>>> df = pd.DataFrame([['a'], ['a'], ['a'], ['b'], ['b'], ['a']],
...                   columns=['A'])
>>> df
   A
0  a
1  a
2  a
3  b
4  b
5  a
>>> df.groupby('A').cumcount()
0    0
1    1
2    2
3    0
4    1
5    3
dtype: int64
>>> df.groupby('A').cumcount(ascending=False)
0    3
1    2
2    1
3    1
4    0
5    0
dtype: int64
pandas.core.groupby.DataFrameGroupBy.cummax   DataFrameGroupBy.cummax(axis=0, **kwargs)[source]
 
Cumulative max for each group.  Returns 
 Series or DataFrame
    See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.cummin   DataFrameGroupBy.cummin(axis=0, **kwargs)[source]
 
Cumulative min for each group.  Returns 
 Series or DataFrame
    See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.cumprod   DataFrameGroupBy.cumprod(axis=0, *args, **kwargs)[source]
 
Cumulative product for each group.  Returns 
 Series or DataFrame
    See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.cumsum   DataFrameGroupBy.cumsum(axis=0, *args, **kwargs)[source]
 
Cumulative sum for each group.  Returns 
 Series or DataFrame
    See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.diff   propertyDataFrameGroupBy.diff
 
First discrete difference of element. Calculates the difference of a Dataframe element compared with another element in the Dataframe (default is element in previous row).  Parameters 
 
periods:int, default 1


Periods to shift for calculating difference, accepts negative values.  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Take difference over rows (0) or columns (1).    Returns 
 Dataframe

First differences of the Series.      See also  Dataframe.pct_change

Percent change over given number of periods.  Dataframe.shift

Shift index by desired number of periods with an optional time freq.  Series.diff

First discrete difference of object.    Notes For boolean dtypes, this uses operator.xor() rather than operator.sub(). The result is calculated according to current dtype in Dataframe, however dtype of the result is always float64. Examples Difference with previous row 
>>> df = pd.DataFrame({'a': [1, 2, 3, 4, 5, 6],
...                    'b': [1, 1, 2, 3, 5, 8],
...                    'c': [1, 4, 9, 16, 25, 36]})
>>> df
   a  b   c
0  1  1   1
1  2  1   4
2  3  2   9
3  4  3  16
4  5  5  25
5  6  8  36
  
>>> df.diff()
     a    b     c
0  NaN  NaN   NaN
1  1.0  0.0   3.0
2  1.0  1.0   5.0
3  1.0  1.0   7.0
4  1.0  2.0   9.0
5  1.0  3.0  11.0
  Difference with previous column 
>>> df.diff(axis=1)
    a  b   c
0 NaN  0   0
1 NaN -1   3
2 NaN -1   7
3 NaN -1  13
4 NaN  0  20
5 NaN  2  28
  Difference with 3rd previous row 
>>> df.diff(periods=3)
     a    b     c
0  NaN  NaN   NaN
1  NaN  NaN   NaN
2  NaN  NaN   NaN
3  3.0  2.0  15.0
4  3.0  4.0  21.0
5  3.0  6.0  27.0
  Difference with following row 
>>> df.diff(periods=-1)
     a    b     c
0 -1.0  0.0  -3.0
1 -1.0 -1.0  -5.0
2 -1.0 -1.0  -7.0
3 -1.0 -2.0  -9.0
4 -1.0 -3.0 -11.0
5  NaN  NaN   NaN
  Overflow in input dtype 
>>> df = pd.DataFrame({'a': [1, 0]}, dtype=np.uint8)
>>> df.diff()
       a
0    NaN
1  255.0
pandas.core.groupby.DataFrameGroupBy.ffill   DataFrameGroupBy.ffill(limit=None)[source]
 
Forward fill the values.  Parameters 
 
limit:int, optional


Limit of how many values to fill.    Returns 
 Series or DataFrame

Object with missing values filled.      See also  Series.ffill

Returns Series with minimum number of char in object.  DataFrame.ffill

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

Fill NaN values of a Series.  DataFrame.fillna

Fill NaN values of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.filter   DataFrameGroupBy.filter(func, dropna=True, *args, **kwargs)[source]
 
Return a copy of a DataFrame excluding filtered elements. Elements from groups are filtered if they do not satisfy the boolean criterion specified by func.  Parameters 
 
func:function


Function to apply to each subframe. Should return True or False.  
dropna:Drop groups that do not pass the filter. True by default;


If False, groups that evaluate False are filled with NaNs.    Returns 
 
filtered:DataFrame

   Notes Each subframe is endowed the attribute ‘name’ in case you need to know which group you are working on. Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. Examples 
>>> df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
...                           'foo', 'bar'],
...                    'B' : [1, 2, 3, 4, 5, 6],
...                    'C' : [2.0, 5., 8., 1., 2., 9.]})
>>> grouped = df.groupby('A')
>>> grouped.filter(lambda x: x['B'].mean() > 3.)
     A  B    C
1  bar  2  5.0
3  bar  4  1.0
5  bar  6  9.0
pandas.core.groupby.DataFrameGroupBy.hist   propertyDataFrameGroupBy.hist
 
Make a histogram of the DataFrame’s columns. A histogram is a representation of the distribution of data. This function calls matplotlib.pyplot.hist(), on each series in the DataFrame, resulting in one histogram per column.  Parameters 
 
data:DataFrame


The pandas object holding the data.  
column:str or sequence, optional


If passed, will be used to limit data to a subset of columns.  
by:object, optional


If passed, then used to form histograms for separate groups.  
grid:bool, default True


Whether to show axis grid lines.  
xlabelsize:int, default None


If specified changes the x-axis label size.  
xrot:float, default None


Rotation of x axis labels. For example, a value of 90 displays the x labels rotated 90 degrees clockwise.  
ylabelsize:int, default None


If specified changes the y-axis label size.  
yrot:float, default None


Rotation of y axis labels. For example, a value of 90 displays the y labels rotated 90 degrees clockwise.  
ax:Matplotlib axes object, default None


The axes to plot the histogram on.  
sharex:bool, default True if ax is None else False


In case subplots=True, share x axis and set some x axis labels to invisible; defaults to True if ax is None otherwise False if an ax is passed in. Note that passing in both an ax and sharex=True will alter all x axis labels for all subplots in a figure.  
sharey:bool, default False


In case subplots=True, share y axis and set some y axis labels to invisible.  
figsize:tuple, optional


The size in inches of the figure to create. Uses the value in matplotlib.rcParams by default.  
layout:tuple, optional


Tuple of (rows, columns) for the layout of the histograms.  
bins:int or sequence, default 10


Number of histogram bins to be used. If an integer is given, bins + 1 bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified.  
backend:str, default None


Backend to use instead of the backend specified in the option plotting.backend. For instance, ‘matplotlib’. Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.  New in version 1.0.0.   
legend:bool, default False


Whether to show the legend.  New in version 1.1.0.   **kwargs

All other plotting keyword arguments to be passed to matplotlib.pyplot.hist().    Returns 
 matplotlib.AxesSubplot or numpy.ndarray of them
    See also  matplotlib.pyplot.hist

Plot a histogram using matplotlib.    Examples This example draws a histogram based on the length and width of some animals, displayed in three bins 
>>> df = pd.DataFrame({
...     'length': [1.5, 0.5, 1.2, 0.9, 3],
...     'width': [0.7, 0.2, 0.15, 0.2, 1.1]
...     }, index=['pig', 'rabbit', 'duck', 'chicken', 'horse'])
>>> hist = df.hist(bins=3)
pandas.core.groupby.DataFrameGroupBy.idxmax   DataFrameGroupBy.idxmax(axis=0, skipna=True)[source]
 
Return index of first occurrence of maximum over requested axis. NA/null values are excluded.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to use. 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise.  
skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.    Returns 
 Series

Indexes of maxima along the specified axis.    Raises 
 ValueError

 If the row/column is empty       See also  Series.idxmax

Return index of the maximum element.    Notes This method is the DataFrame version of ndarray.argmax. Examples Consider a dataset containing food consumption in Argentina. 
>>> df = pd.DataFrame({'consumption': [10.51, 103.11, 55.48],
...                    'co2_emissions': [37.2, 19.66, 1712]},
...                    index=['Pork', 'Wheat Products', 'Beef'])
  
>>> df
                consumption  co2_emissions
Pork                  10.51         37.20
Wheat Products       103.11         19.66
Beef                  55.48       1712.00
  By default, it returns the index for the maximum value in each column. 
>>> df.idxmax()
consumption     Wheat Products
co2_emissions             Beef
dtype: object
  To return the index for the maximum value in each row, use axis="columns". 
>>> df.idxmax(axis="columns")
Pork              co2_emissions
Wheat Products     consumption
Beef              co2_emissions
dtype: object
pandas.core.groupby.DataFrameGroupBy.idxmin   DataFrameGroupBy.idxmin(axis=0, skipna=True)[source]
 
Return index of first occurrence of minimum over requested axis. NA/null values are excluded.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The axis to use. 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise.  
skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.    Returns 
 Series

Indexes of minima along the specified axis.    Raises 
 ValueError

 If the row/column is empty       See also  Series.idxmin

Return index of the minimum element.    Notes This method is the DataFrame version of ndarray.argmin. Examples Consider a dataset containing food consumption in Argentina. 
>>> df = pd.DataFrame({'consumption': [10.51, 103.11, 55.48],
...                    'co2_emissions': [37.2, 19.66, 1712]},
...                    index=['Pork', 'Wheat Products', 'Beef'])
  
>>> df
                consumption  co2_emissions
Pork                  10.51         37.20
Wheat Products       103.11         19.66
Beef                  55.48       1712.00
  By default, it returns the index for the minimum value in each column. 
>>> df.idxmin()
consumption                Pork
co2_emissions    Wheat Products
dtype: object
  To return the index for the minimum value in each row, use axis="columns". 
>>> df.idxmin(axis="columns")
Pork                consumption
Wheat Products    co2_emissions
Beef                consumption
dtype: object
pandas.core.groupby.DataFrameGroupBy.mad   propertyDataFrameGroupBy.mad
 
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.core.groupby.DataFrameGroupBy.nunique   DataFrameGroupBy.nunique(dropna=True)[source]
 
Return DataFrame with counts of unique elements in each position.  Parameters 
 
dropna:bool, default True


Don’t include NaN in the counts.    Returns 
 nunique: DataFrame
   Examples 
>>> df = pd.DataFrame({'id': ['spam', 'egg', 'egg', 'spam',
...                           'ham', 'ham'],
...                    'value1': [1, 5, 5, 2, 5, 5],
...                    'value2': list('abbaxy')})
>>> df
     id  value1 value2
0  spam       1      a
1   egg       5      b
2   egg       5      b
3  spam       2      a
4   ham       5      x
5   ham       5      y
  
>>> df.groupby('id').nunique()
      value1  value2
id
egg        1       1
ham        1       2
spam       2       1
  Check for rows with the same id but conflicting values: 
>>> df.groupby('id').filter(lambda g: (g.nunique() > 1).any())
     id  value1 value2
0  spam       1      a
3  spam       2      a
4   ham       5      x
5   ham       5      y
pandas.core.groupby.DataFrameGroupBy.pad   DataFrameGroupBy.pad(limit=None)[source]
 
Forward fill the values.  Parameters 
 
limit:int, optional


Limit of how many values to fill.    Returns 
 Series or DataFrame

Object with missing values filled.      See also  Series.ffill

Returns Series with minimum number of char in object.  DataFrame.ffill

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

Fill NaN values of a Series.  DataFrame.fillna

Fill NaN values of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.pct_change   DataFrameGroupBy.pct_change(periods=1, fill_method='ffill', limit=None, freq=None, axis=0)[source]
 
Calculate pct_change of each value to previous entry in group.  Returns 
 Series or DataFrame

Percentage changes within each group.      See also  Series.groupby

Apply a function groupby to a Series.  DataFrame.groupby

Apply a function groupby to each row or column of a DataFrame.
pandas.core.groupby.DataFrameGroupBy.plot   propertyDataFrameGroupBy.plot
 
Class implementing the .plot attribute for groupby objects.