neulab/docprompting-conala huggingface dataset:
pandas.DataFrame.cumsum   DataFrame.cumsum(axis=None, skipna=True, *args, **kwargs)[source]
 
Return cumulative sum over a DataFrame or Series axis. Returns a DataFrame or Series of the same size containing the cumulative sum.  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 sum of Series or DataFrame.      See also  core.window.Expanding.sum

Similar functionality but ignores NaN values.  DataFrame.sum

Return the sum 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.cumsum()
0    2.0
1    NaN
2    7.0
3    6.0
4    6.0
dtype: float64
  To include NA values in the operation, use skipna=False 
>>> s.cumsum(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 sum in each column. This is equivalent to axis=None or axis='index'. 
>>> df.cumsum()
     A    B
0  2.0  1.0
1  5.0  NaN
2  6.0  1.0
  To iterate over columns and find the sum in each row, use axis=1 
>>> df.cumsum(axis=1)
     A    B
0  2.0  3.0
1  3.0  NaN
2  1.0  1.0
pandas.DataFrame.diff   DataFrame.diff(periods=1, axis=0)[source]
 
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.DataFrame.dot   DataFrame.dot(other)[source]
 
Compute the matrix multiplication between the DataFrame and other. This method computes the matrix product between the DataFrame and the values of an other Series, DataFrame or a numpy array. It can also be called using self @ other in Python >= 3.5.  Parameters 
 
other:Series, DataFrame or array-like


The other object to compute the matrix product with.    Returns 
 Series or DataFrame

If other is a Series, return the matrix product between self and other as a Series. If other is a DataFrame or a numpy.array, return the matrix product of self and other in a DataFrame of a np.array.      See also  Series.dot

Similar method for Series.    Notes The dimensions of DataFrame and other must be compatible in order to compute the matrix multiplication. In addition, the column names of DataFrame and the index of other must contain the same values, as they will be aligned prior to the multiplication. The dot method for Series computes the inner product, instead of the matrix product here. Examples Here we multiply a DataFrame with a Series. 
>>> df = pd.DataFrame([[0, 1, -2, -1], [1, 1, 1, 1]])
>>> s = pd.Series([1, 1, 2, 1])
>>> df.dot(s)
0    -4
1     5
dtype: int64
  Here we multiply a DataFrame with another DataFrame. 
>>> other = pd.DataFrame([[0, 1], [1, 2], [-1, -1], [2, 0]])
>>> df.dot(other)
    0   1
0   1   4
1   2   2
  Note that the dot method give the same result as @ 
>>> df @ other
    0   1
0   1   4
1   2   2
  The dot method works also if other is an np.array. 
>>> arr = np.array([[0, 1], [1, 2], [-1, -1], [2, 0]])
>>> df.dot(arr)
    0   1
0   1   4
1   2   2
  Note how shuffling of the objects does not change the result. 
>>> s2 = s.reindex([1, 0, 2, 3])
>>> df.dot(s2)
0    -4
1     5
dtype: int64
pandas.DataFrame.drop_duplicates   DataFrame.drop_duplicates(subset=None, keep='first', inplace=False, ignore_index=False)[source]
 
Return DataFrame with duplicate rows removed. Considering certain columns is optional. Indexes, including time indexes are ignored.  Parameters 
 
subset:column label or sequence of labels, optional


Only consider certain columns for identifying duplicates, by default use all of the columns.  
keep:{‘first’, ‘last’, False}, default ‘first’


Determines which duplicates (if any) to keep. - first : Drop duplicates except for the first occurrence. - last : Drop duplicates except for the last occurrence. - False : Drop all duplicates.  
inplace:bool, default False


Whether to drop duplicates in place or to return a copy.  
ignore_index:bool, default False


If True, the resulting axis will be labeled 0, 1, …, n - 1.  New in version 1.0.0.     Returns 
 DataFrame or None

DataFrame with duplicates removed or None if inplace=True.      See also  DataFrame.value_counts

Count unique combinations of columns.    Examples Consider dataset containing ramen rating. 
>>> df = pd.DataFrame({
...     'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
...     'style': ['cup', 'cup', 'cup', 'pack', 'pack'],
...     'rating': [4, 4, 3.5, 15, 5]
... })
>>> df
    brand style  rating
0  Yum Yum   cup     4.0
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0
  By default, it removes duplicate rows based on all columns. 
>>> df.drop_duplicates()
    brand style  rating
0  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0
  To remove duplicates on specific column(s), use subset. 
>>> df.drop_duplicates(subset=['brand'])
    brand style  rating
0  Yum Yum   cup     4.0
2  Indomie   cup     3.5
  To remove duplicates and keep last occurrences, use keep. 
>>> df.drop_duplicates(subset=['brand', 'style'], keep='last')
    brand style  rating
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
4  Indomie  pack     5.0
pandas.DataFrame.droplevel   DataFrame.droplevel(level, axis=0)[source]
 
Return Series/DataFrame with requested index / column level(s) removed.  Parameters 
 
level:int, str, or list-like


If a string is given, must be the name of a level If list-like, elements must be names or positional indexes of levels.  
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Axis along which the level(s) is removed:  0 or ‘index’: remove level(s) in column. 1 or ‘columns’: remove level(s) in row.     Returns 
 Series/DataFrame

Series/DataFrame with requested index / column level(s) removed.     Examples 
>>> df = pd.DataFrame([
...     [1, 2, 3, 4],
...     [5, 6, 7, 8],
...     [9, 10, 11, 12]
... ]).set_index([0, 1]).rename_axis(['a', 'b'])
  
>>> df.columns = pd.MultiIndex.from_tuples([
...     ('c', 'e'), ('d', 'f')
... ], names=['level_1', 'level_2'])
  
>>> df
level_1   c   d
level_2   e   f
a b
1 2      3   4
5 6      7   8
9 10    11  12
  
>>> df.droplevel('a')
level_1   c   d
level_2   e   f
b
2        3   4
6        7   8
10      11  12
  
>>> df.droplevel('level_2', axis=1)
level_1   c   d
a b
1 2      3   4
5 6      7   8
9 10    11  12
pandas.DataFrame.dropna   DataFrame.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)[source]
 
Remove missing values. See the User Guide for more on which values are considered missing, and how to work with missing data.  Parameters 
 
axis:{0 or ‘index’, 1 or ‘columns’}, default 0


Determine if rows or columns which contain missing values are removed.  0, or ‘index’ : Drop rows which contain missing values. 1, or ‘columns’ : Drop columns which contain missing value.   Changed in version 1.0.0: Pass tuple or list to drop on multiple axes. Only a single axis is allowed.   
how:{‘any’, ‘all’}, default ‘any’


Determine if row or column is removed from DataFrame, when we have at least one NA or all NA.  ‘any’ : If any NA values are present, drop that row or column. ‘all’ : If all values are NA, drop that row or column.   
thresh:int, optional


Require that many non-NA values.  
subset:column label or sequence of labels, optional


Labels along other axis to consider, e.g. if you are dropping rows these would be a list of columns to include.  
inplace:bool, default False


If True, do operation inplace and return None.    Returns 
 DataFrame or None

DataFrame with NA entries dropped from it or None if inplace=True.      See also  DataFrame.isna

Indicate missing values.  DataFrame.notna

Indicate existing (non-missing) values.  DataFrame.fillna

Replace missing values.  Series.dropna

Drop missing values.  Index.dropna

Drop missing indices.    Examples 
>>> df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
...                    "toy": [np.nan, 'Batmobile', 'Bullwhip'],
...                    "born": [pd.NaT, pd.Timestamp("1940-04-25"),
...                             pd.NaT]})
>>> df
       name        toy       born
0    Alfred        NaN        NaT
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
  Drop the rows where at least one element is missing. 
>>> df.dropna()
     name        toy       born
1  Batman  Batmobile 1940-04-25
  Drop the columns where at least one element is missing. 
>>> df.dropna(axis='columns')
       name
0    Alfred
1    Batman
2  Catwoman
  Drop the rows where all elements are missing. 
>>> df.dropna(how='all')
       name        toy       born
0    Alfred        NaN        NaT
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
  Keep only the rows with at least 2 non-NA values. 
>>> df.dropna(thresh=2)
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
  Define in which columns to look for missing values. 
>>> df.dropna(subset=['name', 'toy'])
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
  Keep the DataFrame with valid entries in the same variable. 
>>> df.dropna(inplace=True)
>>> df
     name        toy       born
1  Batman  Batmobile 1940-04-25
pandas.DataFrame.dtypes   propertyDataFrame.dtypes
 
Return the dtypes in the DataFrame. This returns a Series with the data type of each column. The result’s index is the original DataFrame’s columns. Columns with mixed types are stored with the object dtype. See the User Guide for more.  Returns 
 pandas.Series

The data type of each column.     Examples 
>>> df = pd.DataFrame({'float': [1.0],
...                    'int': [1],
...                    'datetime': [pd.Timestamp('20180310')],
...                    'string': ['foo']})
>>> df.dtypes
float              float64
int                  int64
datetime    datetime64[ns]
string              object
dtype: object
pandas.DataFrame.duplicated   DataFrame.duplicated(subset=None, keep='first')[source]
 
Return boolean Series denoting duplicate rows. Considering certain columns is optional.  Parameters 
 
subset:column label or sequence of labels, optional


Only consider certain columns for identifying duplicates, by default use all of the columns.  
keep:{‘first’, ‘last’, False}, default ‘first’


Determines which duplicates (if any) to mark.  first : Mark duplicates as True except for the first occurrence. last : Mark duplicates as True except for the last occurrence. False : Mark all duplicates as True.     Returns 
 Series

Boolean series for each duplicated rows.      See also  Index.duplicated

Equivalent method on index.  Series.duplicated

Equivalent method on Series.  Series.drop_duplicates

Remove duplicate values from Series.  DataFrame.drop_duplicates

Remove duplicate values from DataFrame.    Examples Consider dataset containing ramen rating. 
>>> df = pd.DataFrame({
...     'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
...     'style': ['cup', 'cup', 'cup', 'pack', 'pack'],
...     'rating': [4, 4, 3.5, 15, 5]
... })
>>> df
    brand style  rating
0  Yum Yum   cup     4.0
1  Yum Yum   cup     4.0
2  Indomie   cup     3.5
3  Indomie  pack    15.0
4  Indomie  pack     5.0
  By default, for each set of duplicated values, the first occurrence is set on False and all others on True. 
>>> df.duplicated()
0    False
1     True
2    False
3    False
4    False
dtype: bool
  By using ‘last’, the last occurrence of each set of duplicated values is set on False and all others on True. 
>>> df.duplicated(keep='last')
0     True
1    False
2    False
3    False
4    False
dtype: bool
  By setting keep on False, all duplicates are True. 
>>> df.duplicated(keep=False)
0     True
1     True
2    False
3    False
4    False
dtype: bool
  To find duplicates on specific column(s), use subset. 
>>> df.duplicated(subset=['brand'])
0    False
1     True
2    False
3     True
4     True
dtype: bool
pandas.DataFrame.empty   propertyDataFrame.empty
 
Indicator whether Series/DataFrame is empty. True if Series/DataFrame is entirely empty (no items), meaning any of the axes are of length 0.  Returns 
 bool

If Series/DataFrame is empty, return True, if not return False.      See also  Series.dropna

Return series without null values.  DataFrame.dropna

Return DataFrame with labels on given axis omitted where (all or any) data are missing.    Notes If Series/DataFrame contains only NaNs, it is still not considered empty. See the example below. Examples An example of an actual empty DataFrame. Notice the index is empty: 
>>> df_empty = pd.DataFrame({'A' : []})
>>> df_empty
Empty DataFrame
Columns: [A]
Index: []
>>> df_empty.empty
True
  If we only have NaNs in our DataFrame, it is not considered empty! We will need to drop the NaNs to make the DataFrame empty: 
>>> df = pd.DataFrame({'A' : [np.nan]})
>>> df
    A
0 NaN
>>> df.empty
False
>>> df.dropna().empty
True
  
>>> ser_empty = pd.Series({'A' : []})
>>> ser_empty
A    []
dtype: object
>>> ser_empty.empty
False
>>> ser_empty = pd.Series()
>>> ser_empty.empty
True
pandas.DataFrame.equals   DataFrame.equals(other)[source]
 
Test whether two objects contain the same elements. This function allows two Series or DataFrames to be compared against each other to see if they have the same shape and elements. NaNs in the same location are considered equal. The row/column index do not need to have the same type, as long as the values are considered equal. Corresponding columns must be of the same dtype.  Parameters 
 
other:Series or DataFrame


The other Series or DataFrame to be compared with the first.    Returns 
 bool

True if all elements are the same in both objects, False otherwise.      See also  Series.eq

Compare two Series objects of the same length and return a Series where each element is True if the element in each Series is equal, False otherwise.  DataFrame.eq

Compare two DataFrame objects of the same shape and return a DataFrame where each element is True if the respective element in each DataFrame is equal, False otherwise.  testing.assert_series_equal

Raises an AssertionError if left and right are not equal. Provides an easy interface to ignore inequality in dtypes, indexes and precision among others.  testing.assert_frame_equal

Like assert_series_equal, but targets DataFrames.  numpy.array_equal

Return True if two arrays have the same shape and elements, False otherwise.    Examples 
>>> df = pd.DataFrame({1: [10], 2: [20]})
>>> df
    1   2
0  10  20
  DataFrames df and exactly_equal have the same types and values for their elements and column labels, which will return True. 
>>> exactly_equal = pd.DataFrame({1: [10], 2: [20]})
>>> exactly_equal
    1   2
0  10  20
>>> df.equals(exactly_equal)
True
  DataFrames df and different_column_type have the same element types and values, but have different types for the column labels, which will still return True. 
>>> different_column_type = pd.DataFrame({1.0: [10], 2.0: [20]})
>>> different_column_type
   1.0  2.0
0   10   20
>>> df.equals(different_column_type)
True
  DataFrames df and different_data_type have different types for the same values for their elements, and will return False even though their column labels are the same values and types. 
>>> different_data_type = pd.DataFrame({1: [10.0], 2: [20.0]})
>>> different_data_type
      1     2
0  10.0  20.0
>>> df.equals(different_data_type)
False
pandas.DataFrame.eval   DataFrame.eval(expr, inplace=False, **kwargs)[source]
 
Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows eval to run arbitrary code, which can make you vulnerable to code injection if you pass user input to this function.  Parameters 
 
expr:str


The expression string to evaluate.  
inplace:bool, default False


If the expression contains an assignment, whether to perform the operation inplace and mutate the existing DataFrame. Otherwise, a new DataFrame is returned.  **kwargs

See the documentation for eval() for complete details on the keyword arguments accepted by query().    Returns 
 ndarray, scalar, pandas object, or None

The result of the evaluation or None if inplace=True.      See also  DataFrame.query

Evaluates a boolean expression to query the columns of a frame.  DataFrame.assign

Can evaluate an expression or function to create new values for a column.  eval

Evaluate a Python expression as a string using various backends.    Notes For more details see the API documentation for eval(). For detailed examples see enhancing performance with eval. Examples 
>>> df = pd.DataFrame({'A': range(1, 6), 'B': range(10, 0, -2)})
>>> df
   A   B
0  1  10
1  2   8
2  3   6
3  4   4
4  5   2
>>> df.eval('A + B')
0    11
1    10
2     9
3     8
4     7
dtype: int64
  Assignment is allowed though by default the original DataFrame is not modified. 
>>> df.eval('C = A + B')
   A   B   C
0  1  10  11
1  2   8  10
2  3   6   9
3  4   4   8
4  5   2   7
>>> df
   A   B
0  1  10
1  2   8
2  3   6
3  4   4
4  5   2
  Use inplace=True to modify the original DataFrame. 
>>> df.eval('C = A + B', inplace=True)
>>> df
   A   B   C
0  1  10  11
1  2   8  10
2  3   6   9
3  4   4   8
4  5   2   7
  Multiple columns can be assigned to using multi-line expressions: 
>>> df.eval(
...     '''
... C = A + B
... D = A - B
... '''
... )
   A   B   C  D
0  1  10  11 -9
1  2   8  10 -6
2  3   6   9 -3
3  4   4   8  0
4  5   2   7  3
pandas.DataFrame.expanding   DataFrame.expanding(min_periods=1, center=None, axis=0, method='single')[source]
 
Provide expanding window calculations.  Parameters 
 
min_periods:int, default 1


Minimum number of observations in window required to have a value; otherwise, result is np.nan.  
center:bool, default False


If False, set the window labels as the right edge of the window index. If True, set the window labels as the center of the window index.  Deprecated since version 1.1.0.   
axis:int or str, default 0


If 0 or 'index', roll across the rows. If 1 or 'columns', roll across the columns.  
method:str {‘single’, ‘table’}, default ‘single’


Execute the rolling operation per single column or row ('single') or over the entire object ('table'). This argument is only implemented when specifying engine='numba' in the method call.  New in version 1.3.0.     Returns 
 
Expanding subclass
    See also  rolling

Provides rolling window calculations.  ewm

Provides exponential weighted functions.    Notes See Windowing Operations for further usage details and examples. Examples 
>>> df = pd.DataFrame({"B": [0, 1, 2, np.nan, 4]})
>>> df
     B
0  0.0
1  1.0
2  2.0
3  NaN
4  4.0
  min_periods Expanding sum with 1 vs 3 observations needed to calculate a value. 
>>> df.expanding(1).sum()
     B
0  0.0
1  1.0
2  3.0
3  3.0
4  7.0
>>> df.expanding(3).sum()
     B
0  NaN
1  NaN
2  3.0
3  3.0
4  7.0
pandas.DataFrame.explode   DataFrame.explode(column, ignore_index=False)[source]
 
Transform each element of a list-like to a row, replicating index values.  New in version 0.25.0.   Parameters 
 
column:IndexLabel


Column(s) to explode. For multiple columns, specify a non-empty list with each element be str or tuple, and all specified columns their list-like data on same row of the frame must have matching length.  New in version 1.3.0: Multi-column explode   
ignore_index:bool, default False


If True, the resulting index will be labeled 0, 1, …, n - 1.  New in version 1.1.0.     Returns 
 DataFrame

Exploded lists to rows of the subset columns; index will be duplicated for these rows.    Raises 
 ValueError :

 If columns of the frame are not unique. If specified columns to explode is empty list. If specified columns to explode have not matching count of elements rowwise in the frame.       See also  DataFrame.unstack

Pivot a level of the (necessarily hierarchical) index labels.  DataFrame.melt

Unpivot a DataFrame from wide format to long format.  Series.explode

Explode a DataFrame from list-like columns to long format.    Notes This routine will explode list-likes including lists, tuples, sets, Series, and np.ndarray. The result dtype of the subset rows will be object. Scalars will be returned unchanged, and empty list-likes will result in a np.nan for that row. In addition, the ordering of rows in the output will be non-deterministic when exploding sets. Examples 
>>> df = pd.DataFrame({'A': [[0, 1, 2], 'foo', [], [3, 4]],
...                    'B': 1,
...                    'C': [['a', 'b', 'c'], np.nan, [], ['d', 'e']]})
>>> df
           A  B          C
0  [0, 1, 2]  1  [a, b, c]
1        foo  1        NaN
2         []  1         []
3     [3, 4]  1     [d, e]
  Single-column explode. 
>>> df.explode('A')
     A  B          C
0    0  1  [a, b, c]
0    1  1  [a, b, c]
0    2  1  [a, b, c]
1  foo  1        NaN
2  NaN  1         []
3    3  1     [d, e]
3    4  1     [d, e]
  Multi-column explode. 
>>> df.explode(list('AC'))
     A  B    C
0    0  1    a
0    1  1    b
0    2  1    c
1  foo  1  NaN
2  NaN  1  NaN
3    3  1    d
3    4  1    e
pandas.DataFrame.ffill   DataFrame.ffill(axis=None, inplace=False, limit=None, downcast=None)[source]
 
Synonym for DataFrame.fillna() with method='ffill'.  Returns 
 Series/DataFrame or None

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