neulab/docprompting-conala huggingface dataset:
pandas.Series.cat.remove_unused_categories   Series.cat.remove_unused_categories(*args, **kwargs)[source]
 
Remove categories which are not used.  Parameters 
 
inplace:bool, default False


Whether or not to drop unused categories inplace or return a copy of this categorical with unused categories dropped.  Deprecated since version 1.2.0.     Returns 
 
cat:Categorical or None


Categorical with unused categories dropped or None if inplace=True.      See also  rename_categories

Rename categories.  reorder_categories

Reorder categories.  add_categories

Add new categories.  remove_categories

Remove the specified categories.  set_categories

Set the categories to the specified ones.    Examples 
>>> c = pd.Categorical(['a', 'c', 'b', 'c', 'd'])
>>> c
['a', 'c', 'b', 'c', 'd']
Categories (4, object): ['a', 'b', 'c', 'd']
  
>>> c[2] = 'a'
>>> c[4] = 'c'
>>> c
['a', 'c', 'a', 'c', 'c']
Categories (4, object): ['a', 'b', 'c', 'd']
  
>>> c.remove_unused_categories()
['a', 'c', 'a', 'c', 'c']
Categories (2, object): ['a', 'c']
pandas.Series.cat.rename_categories   Series.cat.rename_categories(*args, **kwargs)[source]
 
Rename categories.  Parameters 
 
new_categories:list-like, dict-like or callable


New categories which will replace old categories.  list-like: all items must be unique and the number of items in the new categories must match the existing number of categories. dict-like: specifies a mapping from old categories to new. Categories not contained in the mapping are passed through and extra categories in the mapping are ignored. callable : a callable that is called on all items in the old categories and whose return values comprise the new categories.   
inplace:bool, default False


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


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

If new categories are list-like and do not have the same number of items than the current categories or do not validate as categories      See also  reorder_categories

Reorder 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.    Examples 
>>> c = pd.Categorical(['a', 'a', 'b'])
>>> c.rename_categories([0, 1])
[0, 0, 1]
Categories (2, int64): [0, 1]
  For dict-like new_categories, extra keys are ignored and categories not in the dictionary are passed through 
>>> c.rename_categories({'a': 'A', 'c': 'C'})
['A', 'A', 'b']
Categories (2, object): ['A', 'b']
  You may also provide a callable to create the new categories 
>>> c.rename_categories(lambda x: x.upper())
['A', 'A', 'B']
Categories (2, object): ['A', 'B']
pandas.Series.cat.reorder_categories   Series.cat.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.Series.cat.set_categories   Series.cat.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.Series.clip   Series.clip(lower=None, upper=None, axis=None, inplace=False, *args, **kwargs)[source]
 
Trim values at input threshold(s). Assigns values outside boundary to boundary values. Thresholds can be singular values or array like, and in the latter case the clipping is performed element-wise in the specified axis.  Parameters 
 
lower:float or array-like, default None


Minimum threshold value. All values below this threshold will be set to it. A missing threshold (e.g NA) will not clip the value.  
upper:float or array-like, default None


Maximum threshold value. All values above this threshold will be set to it. A missing threshold (e.g NA) will not clip the value.  
axis:int or str axis name, optional


Align object with lower and upper along the given axis.  
inplace:bool, default False


Whether to perform the operation in place on the data.  *args, **kwargs

Additional keywords have no effect but might be accepted for compatibility with numpy.    Returns 
 Series or DataFrame or None

Same type as calling object with the values outside the clip boundaries replaced or None if inplace=True.      See also  Series.clip

Trim values at input threshold in series.  DataFrame.clip

Trim values at input threshold in dataframe.  numpy.clip

Clip (limit) the values in an array.    Examples 
>>> data = {'col_0': [9, -3, 0, -1, 5], 'col_1': [-2, -7, 6, 8, -5]}
>>> df = pd.DataFrame(data)
>>> df
   col_0  col_1
0      9     -2
1     -3     -7
2      0      6
3     -1      8
4      5     -5
  Clips per column using lower and upper thresholds: 
>>> df.clip(-4, 6)
   col_0  col_1
0      6     -2
1     -3     -4
2      0      6
3     -1      6
4      5     -4
  Clips using specific lower and upper thresholds per column element: 
>>> t = pd.Series([2, -4, -1, 6, 3])
>>> t
0    2
1   -4
2   -1
3    6
4    3
dtype: int64
  
>>> df.clip(t, t + 4, axis=0)
   col_0  col_1
0      6      2
1     -3     -4
2      0      3
3      6      8
4      5      3
  Clips using specific lower threshold per column element, with missing values: 
>>> t = pd.Series([2, -4, np.NaN, 6, 3])
>>> t
0    2.0
1   -4.0
2    NaN
3    6.0
4    3.0
dtype: float64
  
>>> df.clip(t, axis=0)
col_0  col_1
0      9      2
1     -3     -4
2      0      6
3      6      8
4      5      3
pandas.Series.combine   Series.combine(other, func, fill_value=None)[source]
 
Combine the Series with a Series or scalar according to func. Combine the Series and other using func to perform elementwise selection for combined Series. fill_value is assumed when value is missing at some index from one of the two objects being combined.  Parameters 
 
other:Series or scalar


The value(s) to be combined with the Series.  
func:function


Function that takes two scalars as inputs and returns an element.  
fill_value:scalar, optional


The value to assume when an index is missing from one Series or the other. The default specifies to use the appropriate NaN value for the underlying dtype of the Series.    Returns 
 Series

The result of combining the Series with the other object.      See also  Series.combine_first

Combine Series values, choosing the calling Series’ values first.    Examples Consider 2 Datasets s1 and s2 containing highest clocked speeds of different birds. 
>>> s1 = pd.Series({'falcon': 330.0, 'eagle': 160.0})
>>> s1
falcon    330.0
eagle     160.0
dtype: float64
>>> s2 = pd.Series({'falcon': 345.0, 'eagle': 200.0, 'duck': 30.0})
>>> s2
falcon    345.0
eagle     200.0
duck       30.0
dtype: float64
  Now, to combine the two datasets and view the highest speeds of the birds across the two datasets 
>>> s1.combine(s2, max)
duck        NaN
eagle     200.0
falcon    345.0
dtype: float64
  In the previous example, the resulting value for duck is missing, because the maximum of a NaN and a float is a NaN. So, in the example, we set fill_value=0, so the maximum value returned will be the value from some dataset. 
>>> s1.combine(s2, max, fill_value=0)
duck       30.0
eagle     200.0
falcon    345.0
dtype: float64
pandas.Series.combine_first   Series.combine_first(other)[source]
 
Update null elements with value in the same location in ‘other’. Combine two Series objects by filling null values in one Series with non-null values from the other Series. Result index will be the union of the two indexes.  Parameters 
 
other:Series


The value(s) to be used for filling null values.    Returns 
 Series

The result of combining the provided Series with the other object.      See also  Series.combine

Perform element-wise operation on two Series using a given function.    Examples 
>>> s1 = pd.Series([1, np.nan])
>>> s2 = pd.Series([3, 4, 5])
>>> s1.combine_first(s2)
0    1.0
1    4.0
2    5.0
dtype: float64
  Null values still persist if the location of that null value does not exist in other 
>>> s1 = pd.Series({'falcon': np.nan, 'eagle': 160.0})
>>> s2 = pd.Series({'eagle': 200.0, 'duck': 30.0})
>>> s1.combine_first(s2)
duck       30.0
eagle     160.0
falcon      NaN
dtype: float64
pandas.Series.compare   Series.compare(other, align_axis=1, keep_shape=False, keep_equal=False)[source]
 
Compare to another Series and show the differences.  New in version 1.1.0.   Parameters 
 
other:Series


Object to compare with.  
align_axis:{0 or ‘index’, 1 or ‘columns’}, default 1


Determine which axis to align the comparison on.  
 0, or ‘index’:Resulting differences are stacked vertically


with rows drawn alternately from self and other.    
 1, or ‘columns’:Resulting differences are aligned horizontally


with columns drawn alternately from self and other.      
keep_shape:bool, default False


If true, all rows and columns are kept. Otherwise, only the ones with different values are kept.  
keep_equal:bool, default False


If true, the result keeps values that are equal. Otherwise, equal values are shown as NaNs.    Returns 
 Series or DataFrame

If axis is 0 or ‘index’ the result will be a Series. The resulting index will be a MultiIndex with ‘self’ and ‘other’ stacked alternately at the inner level. If axis is 1 or ‘columns’ the result will be a DataFrame. It will have two columns namely ‘self’ and ‘other’.      See also  DataFrame.compare

Compare with another DataFrame and show differences.    Notes Matching NaNs will not appear as a difference. Examples 
>>> s1 = pd.Series(["a", "b", "c", "d", "e"])
>>> s2 = pd.Series(["a", "a", "c", "b", "e"])
  Align the differences on columns 
>>> s1.compare(s2)
  self other
1    b     a
3    d     b
  Stack the differences on indices 
>>> s1.compare(s2, align_axis=0)
1  self     b
   other    a
3  self     d
   other    b
dtype: object
  Keep all original rows 
>>> s1.compare(s2, keep_shape=True)
  self other
0  NaN   NaN
1    b     a
2  NaN   NaN
3    d     b
4  NaN   NaN
  Keep all original rows and also all original values 
>>> s1.compare(s2, keep_shape=True, keep_equal=True)
  self other
0    a     a
1    b     a
2    c     c
3    d     b
4    e     e
pandas.Series.copy   Series.copy(deep=True)[source]
 
Make a copy of this object’s indices and data. When deep=True (default), a new object will be created with a copy of the calling object’s data and indices. Modifications to the data or indices of the copy will not be reflected in the original object (see notes below). When deep=False, a new object will be created without copying the calling object’s data or index (only references to the data and index are copied). Any changes to the data of the original will be reflected in the shallow copy (and vice versa).  Parameters 
 
deep:bool, default True


Make a deep copy, including a copy of the data and the indices. With deep=False neither the indices nor the data are copied.    Returns 
 
copy:Series or DataFrame


Object type matches caller.     Notes When deep=True, data is copied but actual Python objects will not be copied recursively, only the reference to the object. This is in contrast to copy.deepcopy in the Standard Library, which recursively copies object data (see examples below). While Index objects are copied when deep=True, the underlying numpy array is not copied for performance reasons. Since Index is immutable, the underlying data can be safely shared and a copy is not needed. Examples 
>>> s = pd.Series([1, 2], index=["a", "b"])
>>> s
a    1
b    2
dtype: int64
  
>>> s_copy = s.copy()
>>> s_copy
a    1
b    2
dtype: int64
  Shallow copy versus default (deep) copy: 
>>> s = pd.Series([1, 2], index=["a", "b"])
>>> deep = s.copy()
>>> shallow = s.copy(deep=False)
  Shallow copy shares data and index with original. 
>>> s is shallow
False
>>> s.values is shallow.values and s.index is shallow.index
True
  Deep copy has own copy of data and index. 
>>> s is deep
False
>>> s.values is deep.values or s.index is deep.index
False
  Updates to the data shared by shallow copy and original is reflected in both; deep copy remains unchanged. 
>>> s[0] = 3
>>> shallow[1] = 4
>>> s
a    3
b    4
dtype: int64
>>> shallow
a    3
b    4
dtype: int64
>>> deep
a    1
b    2
dtype: int64
  Note that when copying an object containing Python objects, a deep copy will copy the data, but will not do so recursively. Updating a nested data object will be reflected in the deep copy. 
>>> s = pd.Series([[1, 2], [3, 4]])
>>> deep = s.copy()
>>> s[0][0] = 10
>>> s
0    [10, 2]
1     [3, 4]
dtype: object
>>> deep
0    [10, 2]
1     [3, 4]
dtype: object
pandas.Series.corr   Series.corr(other, method='pearson', min_periods=None)[source]
 
Compute correlation with other Series, excluding missing values.  Parameters 
 
other:Series


Series with which to compute the correlation.  
method:{‘pearson’, ‘kendall’, ‘spearman’} or callable


Method used to compute 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.   Warning 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 needed to have a valid result.    Returns 
 float

Correlation with other.      See also  DataFrame.corr

Compute pairwise correlation between columns.  DataFrame.corrwith

Compute pairwise correlation with another DataFrame or Series.    Examples 
>>> def histogram_intersection(a, b):
...     v = np.minimum(a, b).sum().round(decimals=1)
...     return v
>>> s1 = pd.Series([.2, .0, .6, .2])
>>> s2 = pd.Series([.3, .6, .0, .1])
>>> s1.corr(s2, method=histogram_intersection)
0.3
pandas.Series.count   Series.count(level=None)[source]
 
Return number of non-NA/null observations in the Series.  Parameters 
 
level:int or level name, default None


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a smaller Series.    Returns 
 int or Series (if level specified)

Number of non-null values in the Series.      See also  DataFrame.count

Count non-NA cells for each column or row.    Examples 
>>> s = pd.Series([0.0, 1.0, np.nan])
>>> s.count()
2
pandas.Series.cov   Series.cov(other, min_periods=None, ddof=1)[source]
 
Compute covariance with Series, excluding missing values.  Parameters 
 
other:Series


Series with which to compute the covariance.  
min_periods:int, optional


Minimum number of observations needed to have a valid result.  
ddof:int, default 1


Delta degrees of freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.  New in version 1.1.0.     Returns 
 float

Covariance between Series and other normalized by N-1 (unbiased estimator).      See also  DataFrame.cov

Compute pairwise covariance of columns.    Examples 
>>> s1 = pd.Series([0.90010907, 0.13484424, 0.62036035])
>>> s2 = pd.Series([0.12528585, 0.26962463, 0.51111198])
>>> s1.cov(s2)
-0.01685762652715874
pandas.Series.cummax   Series.cummax(axis=None, skipna=True, *args, **kwargs)[source]
 
Return cumulative maximum over a DataFrame or Series axis. Returns a DataFrame or Series of the same size containing the cumulative maximum.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The index or the name of the axis. 0 is equivalent to None or ‘index’.  
skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  *args, **kwargs

Additional keywords have no effect but might be accepted for compatibility with NumPy.    Returns 
 scalar or Series

Return cumulative maximum of scalar or Series.      See also  core.window.Expanding.max

Similar functionality but ignores NaN values.  Series.max

Return the maximum over Series axis.  Series.cummax

Return cumulative maximum over Series axis.  Series.cummin

Return cumulative minimum over Series axis.  Series.cumsum

Return cumulative sum over Series axis.  Series.cumprod

Return cumulative product over Series axis.    Examples Series 
>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64
  By default, NA values are ignored. 
>>> s.cummax()
0    2.0
1    NaN
2    5.0
3    5.0
4    5.0
dtype: float64
  To include NA values in the operation, use skipna=False 
>>> s.cummax(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64
  DataFrame 
>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0
  By default, iterates over rows and finds the maximum in each column. This is equivalent to axis=None or axis='index'. 
>>> df.cummax()
     A    B
0  2.0  1.0
1  3.0  NaN
2  3.0  1.0
  To iterate over columns and find the maximum in each row, use axis=1 
>>> df.cummax(axis=1)
     A    B
0  2.0  2.0
1  3.0  NaN
2  1.0  1.0
pandas.Series.cummin   Series.cummin(axis=None, skipna=True, *args, **kwargs)[source]
 
Return cumulative minimum over a DataFrame or Series axis. Returns a DataFrame or Series of the same size containing the cumulative minimum.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The index or the name of the axis. 0 is equivalent to None or ‘index’.  
skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  *args, **kwargs

Additional keywords have no effect but might be accepted for compatibility with NumPy.    Returns 
 scalar or Series

Return cumulative minimum of scalar or Series.      See also  core.window.Expanding.min

Similar functionality but ignores NaN values.  Series.min

Return the minimum over Series axis.  Series.cummax

Return cumulative maximum over Series axis.  Series.cummin

Return cumulative minimum over Series axis.  Series.cumsum

Return cumulative sum over Series axis.  Series.cumprod

Return cumulative product over Series axis.    Examples Series 
>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64
  By default, NA values are ignored. 
>>> s.cummin()
0    2.0
1    NaN
2    2.0
3   -1.0
4   -1.0
dtype: float64
  To include NA values in the operation, use skipna=False 
>>> s.cummin(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64
  DataFrame 
>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0
  By default, iterates over rows and finds the minimum in each column. This is equivalent to axis=None or axis='index'. 
>>> df.cummin()
     A    B
0  2.0  1.0
1  2.0  NaN
2  1.0  0.0
  To iterate over columns and find the minimum in each row, use axis=1 
>>> df.cummin(axis=1)
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0
pandas.Series.cumprod   Series.cumprod(axis=None, skipna=True, *args, **kwargs)[source]
 
Return cumulative product over a DataFrame or Series axis. Returns a DataFrame or Series of the same size containing the cumulative product.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


The index or the name of the axis. 0 is equivalent to None or ‘index’.  
skipna:bool, default True


Exclude NA/null values. If an entire row/column is NA, the result will be NA.  *args, **kwargs

Additional keywords have no effect but might be accepted for compatibility with NumPy.    Returns 
 scalar or Series

Return cumulative product of scalar or Series.      See also  core.window.Expanding.prod

Similar functionality but ignores NaN values.  Series.prod

Return the product over Series axis.  Series.cummax

Return cumulative maximum over Series axis.  Series.cummin

Return cumulative minimum over Series axis.  Series.cumsum

Return cumulative sum over Series axis.  Series.cumprod

Return cumulative product over Series axis.    Examples Series 
>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64
  By default, NA values are ignored. 
>>> s.cumprod()
0     2.0
1     NaN
2    10.0
3   -10.0
4    -0.0
dtype: float64
  To include NA values in the operation, use skipna=False 
>>> s.cumprod(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64
  DataFrame 
>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0
  By default, iterates over rows and finds the product in each column. This is equivalent to axis=None or axis='index'. 
>>> df.cumprod()
     A    B
0  2.0  1.0
1  6.0  NaN
2  6.0  0.0
  To iterate over columns and find the product in each row, use axis=1 
>>> df.cumprod(axis=1)
     A    B
0  2.0  2.0
1  3.0  NaN
2  1.0  0.0