neulab/docprompting-conala huggingface dataset:
pandas.DataFrame.bool   DataFrame.bool()[source]
 
Return the bool of a single element Series or DataFrame. This must be a boolean scalar value, either True or False. It will raise a ValueError if the Series or DataFrame does not have exactly 1 element, or that element is not boolean (integer values 0 and 1 will also raise an exception).  Returns 
 bool

The value in the Series or DataFrame.      See also  Series.astype

Change the data type of a Series, including to boolean.  DataFrame.astype

Change the data type of a DataFrame, including to boolean.  numpy.bool_

NumPy boolean data type, used by pandas for boolean values.    Examples The method will only work for single element objects with a boolean value: 
>>> pd.Series([True]).bool()
True
>>> pd.Series([False]).bool()
False
  
>>> pd.DataFrame({'col': [True]}).bool()
True
>>> pd.DataFrame({'col': [False]}).bool()
False
pandas.DataFrame.clip   DataFrame.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.DataFrame.combine   DataFrame.combine(other, func, fill_value=None, overwrite=True)[source]
 
Perform column-wise combine with another DataFrame. Combines a DataFrame with other DataFrame using func to element-wise combine columns. The row and column indexes of the resulting DataFrame will be the union of the two.  Parameters 
 
other:DataFrame


The DataFrame to merge column-wise.  
func:function


Function that takes two series as inputs and return a Series or a scalar. Used to merge the two dataframes column by columns.  
fill_value:scalar value, default None


The value to fill NaNs with prior to passing any column to the merge func.  
overwrite:bool, default True


If True, columns in self that do not exist in other will be overwritten with NaNs.    Returns 
 DataFrame

Combination of the provided DataFrames.      See also  DataFrame.combine_first

Combine two DataFrame objects and default to non-null values in frame calling the method.    Examples Combine using a simple function that chooses the smaller column. 
>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [4, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> take_smaller = lambda s1, s2: s1 if s1.sum() < s2.sum() else s2
>>> df1.combine(df2, take_smaller)
   A  B
0  0  3
1  0  3
  Example using a true element-wise combine function. 
>>> df1 = pd.DataFrame({'A': [5, 0], 'B': [2, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine(df2, np.minimum)
   A  B
0  1  2
1  0  3
  Using fill_value fills Nones prior to passing the column to the merge function. 
>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine(df2, take_smaller, fill_value=-5)
   A    B
0  0 -5.0
1  0  4.0
  However, if the same element in both dataframes is None, that None is preserved 
>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [None, 3]})
>>> df1.combine(df2, take_smaller, fill_value=-5)
    A    B
0  0 -5.0
1  0  3.0
  Example that demonstrates the use of overwrite and behavior when the axis differ between the dataframes. 
>>> df1 = pd.DataFrame({'A': [0, 0], 'B': [4, 4]})
>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [-10, 1], }, index=[1, 2])
>>> df1.combine(df2, take_smaller)
     A    B     C
0  NaN  NaN   NaN
1  NaN  3.0 -10.0
2  NaN  3.0   1.0
  
>>> df1.combine(df2, take_smaller, overwrite=False)
     A    B     C
0  0.0  NaN   NaN
1  0.0  3.0 -10.0
2  NaN  3.0   1.0
  Demonstrating the preference of the passed in dataframe. 
>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [1, 1], }, index=[1, 2])
>>> df2.combine(df1, take_smaller)
   A    B   C
0  0.0  NaN NaN
1  0.0  3.0 NaN
2  NaN  3.0 NaN
  
>>> df2.combine(df1, take_smaller, overwrite=False)
     A    B   C
0  0.0  NaN NaN
1  0.0  3.0 1.0
2  NaN  3.0 1.0
pandas.DataFrame.combine_first   DataFrame.combine_first(other)[source]
 
Update null elements with value in the same location in other. Combine two DataFrame objects by filling null values in one DataFrame with non-null values from other DataFrame. The row and column indexes of the resulting DataFrame will be the union of the two.  Parameters 
 
other:DataFrame


Provided DataFrame to use to fill null values.    Returns 
 DataFrame

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

Perform series-wise operation on two DataFrames using a given function.    Examples 
>>> df1 = pd.DataFrame({'A': [None, 0], 'B': [None, 4]})
>>> df2 = pd.DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine_first(df2)
     A    B
0  1.0  3.0
1  0.0  4.0
  Null values still persist if the location of that null value does not exist in other 
>>> df1 = pd.DataFrame({'A': [None, 0], 'B': [4, None]})
>>> df2 = pd.DataFrame({'B': [3, 3], 'C': [1, 1]}, index=[1, 2])
>>> df1.combine_first(df2)
     A    B    C
0  NaN  4.0  NaN
1  0.0  3.0  1.0
2  NaN  3.0  1.0
pandas.DataFrame.compare   DataFrame.compare(other, align_axis=1, keep_shape=False, keep_equal=False)[source]
 
Compare to another DataFrame and show the differences.  New in version 1.1.0.   Parameters 
 
other:DataFrame


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 
 DataFrame

DataFrame that shows the differences stacked side by side. The resulting index will be a MultiIndex with ‘self’ and ‘other’ stacked alternately at the inner level.    Raises 
 ValueError

When the two DataFrames don’t have identical labels or shape.      See also  Series.compare

Compare with another Series and show differences.  DataFrame.equals

Test whether two objects contain the same elements.    Notes Matching NaNs will not appear as a difference. Can only compare identically-labeled (i.e. same shape, identical row and column labels) DataFrames Examples 
>>> df = pd.DataFrame(
...     {
...         "col1": ["a", "a", "b", "b", "a"],
...         "col2": [1.0, 2.0, 3.0, np.nan, 5.0],
...         "col3": [1.0, 2.0, 3.0, 4.0, 5.0]
...     },
...     columns=["col1", "col2", "col3"],
... )
>>> df
  col1  col2  col3
0    a   1.0   1.0
1    a   2.0   2.0
2    b   3.0   3.0
3    b   NaN   4.0
4    a   5.0   5.0
  
>>> df2 = df.copy()
>>> df2.loc[0, 'col1'] = 'c'
>>> df2.loc[2, 'col3'] = 4.0
>>> df2
  col1  col2  col3
0    c   1.0   1.0
1    a   2.0   2.0
2    b   3.0   4.0
3    b   NaN   4.0
4    a   5.0   5.0
  Align the differences on columns 
>>> df.compare(df2)
  col1       col3
  self other self other
0    a     c  NaN   NaN
2  NaN   NaN  3.0   4.0
  Stack the differences on rows 
>>> df.compare(df2, align_axis=0)
        col1  col3
0 self     a   NaN
  other    c   NaN
2 self   NaN   3.0
  other  NaN   4.0
  Keep the equal values 
>>> df.compare(df2, keep_equal=True)
  col1       col3
  self other self other
0    a     c  1.0   1.0
2    b     b  3.0   4.0
  Keep all original rows and columns 
>>> df.compare(df2, keep_shape=True)
  col1       col2       col3
  self other self other self other
0    a     c  NaN   NaN  NaN   NaN
1  NaN   NaN  NaN   NaN  NaN   NaN
2  NaN   NaN  NaN   NaN  3.0   4.0
3  NaN   NaN  NaN   NaN  NaN   NaN
4  NaN   NaN  NaN   NaN  NaN   NaN
  Keep all original rows and columns and also all original values 
>>> df.compare(df2, keep_shape=True, keep_equal=True)
  col1       col2       col3
  self other self other self other
0    a     c  1.0   1.0  1.0   1.0
1    a     a  2.0   2.0  2.0   2.0
2    b     b  3.0   3.0  3.0   4.0
3    b     b  NaN   NaN  4.0   4.0
4    a     a  5.0   5.0  5.0   5.0
pandas.DataFrame.copy   DataFrame.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.DataFrame.corr   DataFrame.corr(method='pearson', min_periods=1)[source]
 
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.DataFrame.corrwith   DataFrame.corrwith(other, axis=0, drop=False, method='pearson')[source]
 
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.DataFrame.count   DataFrame.count(axis=0, level=None, numeric_only=False)[source]
 
Count non-NA cells for each column or row. The values None, NaN, NaT, and optionally numpy.inf (depending on pandas.options.mode.use_inf_as_na) are considered NA.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


If 0 or ‘index’ counts are generated for each column. If 1 or ‘columns’ counts are generated for each row.  
level:int or str, optional


If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a DataFrame. A str specifies the level name.  
numeric_only:bool, default False


Include only float, int or boolean data.    Returns 
 Series or DataFrame

For each column/row the number of non-NA/null entries. If level is specified returns a DataFrame.      See also  Series.count

Number of non-NA elements in a Series.  DataFrame.value_counts

Count unique combinations of columns.  DataFrame.shape

Number of DataFrame rows and columns (including NA elements).  DataFrame.isna

Boolean same-sized DataFrame showing places of NA elements.    Examples Constructing DataFrame from a dictionary: 
>>> df = pd.DataFrame({"Person":
...                    ["John", "Myla", "Lewis", "John", "Myla"],
...                    "Age": [24., np.nan, 21., 33, 26],
...                    "Single": [False, True, True, True, False]})
>>> df
   Person   Age  Single
0    John  24.0   False
1    Myla   NaN    True
2   Lewis  21.0    True
3    John  33.0    True
4    Myla  26.0   False
  Notice the uncounted NA values: 
>>> df.count()
Person    5
Age       4
Single    5
dtype: int64
  Counts for each row: 
>>> df.count(axis='columns')
0    3
1    2
2    3
3    3
4    3
dtype: int64
pandas.DataFrame.cummax   DataFrame.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 
 Series or DataFrame

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

Similar functionality but ignores NaN values.  DataFrame.max

Return the maximum over DataFrame axis.  DataFrame.cummax

Return cumulative maximum over DataFrame axis.  DataFrame.cummin

Return cumulative minimum over DataFrame axis.  DataFrame.cumsum

Return cumulative sum over DataFrame axis.  DataFrame.cumprod

Return cumulative product over DataFrame 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.DataFrame.cummin   DataFrame.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 
 Series or DataFrame

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

Similar functionality but ignores NaN values.  DataFrame.min

Return the minimum over DataFrame axis.  DataFrame.cummax

Return cumulative maximum over DataFrame axis.  DataFrame.cummin

Return cumulative minimum over DataFrame axis.  DataFrame.cumsum

Return cumulative sum over DataFrame axis.  DataFrame.cumprod

Return cumulative product over DataFrame 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.DataFrame.cumprod   DataFrame.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 
 Series or DataFrame

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

Similar functionality but ignores NaN values.  DataFrame.prod

Return the product over DataFrame axis.  DataFrame.cummax

Return cumulative maximum over DataFrame axis.  DataFrame.cummin

Return cumulative minimum over DataFrame axis.  DataFrame.cumsum

Return cumulative sum over DataFrame axis.  DataFrame.cumprod

Return cumulative product over DataFrame 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