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.convert_dtypes   DataFrame.convert_dtypes(infer_objects=True, convert_string=True, convert_integer=True, convert_boolean=True, convert_floating=True)[source]

Convert columns to best possible dtypes using dtypes supporting pd.NA.  New in version 1.0.0.   Parameters

infer_objects:bool, default True

Whether object dtypes should be converted to the best possible types.
convert_string:bool, default True

Whether object dtypes should be converted to StringDtype().
convert_integer:bool, default True

Whether, if possible, conversion can be done to integer extension types.
convert_boolean:bool, defaults True

Whether object dtypes should be converted to BooleanDtypes().
convert_floating:bool, defaults True

Whether, if possible, conversion can be done to floating extension types. If convert_integer is also True, preference will be give to integer dtypes if the floats can be faithfully casted to integers.  New in version 1.2.0.     Returns
 Series or DataFrame

Copy of input object with new dtype.      See also  infer_objects

Infer dtypes of objects.  to_datetime

Convert argument to datetime.  to_timedelta

Convert argument to timedelta.  to_numeric

Convert argument to a numeric type.    Notes By default, convert_dtypes will attempt to convert a Series (or each Series in a DataFrame) to dtypes that support pd.NA. By using the options convert_string, convert_integer, convert_boolean and convert_boolean, it is possible to turn off individual conversions to StringDtype, the integer extension types, BooleanDtype or floating extension types, respectively. For object-dtyped columns, if infer_objects is True, use the inference rules as during normal Series/DataFrame construction. Then, if possible, convert to StringDtype, BooleanDtype or an appropriate integer or floating extension type, otherwise leave as object. If the dtype is integer, convert to an appropriate integer extension type. If the dtype is numeric, and consists of all integers, convert to an appropriate integer extension type. Otherwise, convert to an appropriate floating extension type.  Changed in version 1.2: Starting with pandas 1.2, this method also converts float columns to the nullable floating extension type.  In the future, as new dtypes are added that support pd.NA, the results of this method will change to support those new dtypes. Examples
>>> df = pd.DataFrame(
...     {
...         "a": pd.Series([1, 2, 3], dtype=np.dtype("int32")),
...         "b": pd.Series(["x", "y", "z"], dtype=np.dtype("O")),
...         "c": pd.Series([True, False, np.nan], dtype=np.dtype("O")),
...         "d": pd.Series(["h", "i", np.nan], dtype=np.dtype("O")),
...         "e": pd.Series([10, np.nan, 20], dtype=np.dtype("float")),
...         "f": pd.Series([np.nan, 100.5, 200], dtype=np.dtype("float")),
...     }
... )
  Start with a DataFrame with default dtypes.
>>> df
   a  b      c    d     e      f
0  1  x   True    h  10.0    NaN
1  2  y  False    i   NaN  100.5
2  3  z    NaN  NaN  20.0  200.0

>>> df.dtypes
a      int32
b     object
c     object
d     object
e    float64
f    float64
dtype: object
  Convert the DataFrame to use best possible dtypes.
>>> dfn = df.convert_dtypes()
>>> dfn
   a  b      c     d     e      f
0  1  x   True     h    10   <NA>
1  2  y  False     i  <NA>  100.5
2  3  z   <NA>  <NA>    20  200.0

>>> dfn.dtypes
a      Int32
b     string
c    boolean
d     string
e      Int64
f    Float64
dtype: object
  Start with a Series of strings and missing data represented by np.nan.
>>> s = pd.Series(["a", "b", np.nan])
>>> s
0      a
1      b
2    NaN
dtype: object
  Obtain a Series with dtype StringDtype.
>>> s.convert_dtypes()
0       a
1       b
2    <NA>
dtype: string


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.cov   DataFrame.cov(min_periods=None, ddof=1)[source]

Compute pairwise covariance of columns, excluding NA/null values. Compute the pairwise covariance among the series of a DataFrame. The returned data frame is the covariance matrix of the columns of the DataFrame. Both NA and null values are automatically excluded from the calculation. (See the note below about bias from missing values.) A threshold can be set for the minimum number of observations for each value created. Comparisons with observations below this threshold will be returned as NaN. This method is generally used for the analysis of time series data to understand the relationship between different measures across time.  Parameters

min_periods:int, optional

Minimum number of observations required per pair of columns 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
 DataFrame

The covariance matrix of the series of the DataFrame.      See also  Series.cov

Compute covariance with another Series.  core.window.ExponentialMovingWindow.cov

Exponential weighted sample covariance.  core.window.Expanding.cov

Expanding sample covariance.  core.window.Rolling.cov

Rolling sample covariance.    Notes Returns the covariance matrix of the DataFrame’s time series. The covariance is normalized by N-ddof. For DataFrames that have Series that are missing data (assuming that data is missing at random) the returned covariance matrix will be an unbiased estimate of the variance and covariance between the member Series. However, for many applications this estimate may not be acceptable because the estimate covariance matrix is not guaranteed to be positive semi-definite. This could lead to estimate correlations having absolute values which are greater than one, and/or a non-invertible covariance matrix. See Estimation of covariance matrices for more details. Examples
>>> df = pd.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],
...                   columns=['dogs', 'cats'])
>>> df.cov()
          dogs      cats
dogs  0.666667 -1.000000
cats -1.000000  1.666667

>>> np.random.seed(42)
>>> df = pd.DataFrame(np.random.randn(1000, 5),
...                   columns=['a', 'b', 'c', 'd', 'e'])
>>> df.cov()
          a         b         c         d         e
a  0.998438 -0.020161  0.059277 -0.008943  0.014144
b -0.020161  1.059352 -0.008543 -0.024738  0.009826
c  0.059277 -0.008543  1.010670 -0.001486 -0.000271
d -0.008943 -0.024738 -0.001486  0.921297 -0.013692
e  0.014144  0.009826 -0.000271 -0.013692  0.977795
  Minimum number of periods This method also supports an optional min_periods keyword that specifies the required minimum number of non-NA observations for each column pair in order to have a valid result:
>>> np.random.seed(42)
>>> df = pd.DataFrame(np.random.randn(20, 3),
...                   columns=['a', 'b', 'c'])
>>> df.loc[df.index[:5], 'a'] = np.nan
>>> df.loc[df.index[5:10], 'b'] = np.nan
>>> df.cov(min_periods=12)
          a         b         c
a  0.316741       NaN -0.150812
b       NaN  1.248003  0.191417
c -0.150812  0.191417  0.895202


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


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.describe   DataFrame.describe(percentiles=None, include=None, exclude=None, datetime_is_numeric=False)[source]

Generate descriptive statistics. Descriptive statistics include those that summarize the central tendency, dispersion and shape of a dataset’s distribution, excluding NaN values. Analyzes both numeric and object series, as well as DataFrame column sets of mixed data types. The output will vary depending on what is provided. Refer to the notes below for more detail.  Parameters

percentiles:list-like of numbers, optional

The percentiles to include in the output. All should fall between 0 and 1. The default is [.25, .5, .75], which returns the 25th, 50th, and 75th percentiles.
include:‘all’, list-like of dtypes or None (default), optional

A white list of data types to include in the result. Ignored for Series. Here are the options:  ‘all’ : All columns of the input will be included in the output. A list-like of dtypes : Limits the results to the provided data types. To limit the result to numeric types submit numpy.number. To limit it instead to object columns submit the numpy.object data type. Strings can also be used in the style of select_dtypes (e.g. df.describe(include=['O'])). To select pandas categorical columns, use 'category' None (default) : The result will include all numeric columns.
exclude:list-like of dtypes or None (default), optional,

A black list of data types to omit from the result. Ignored for Series. Here are the options:  A list-like of dtypes : Excludes the provided data types from the result. To exclude numeric types submit numpy.number. To exclude object columns submit the data type numpy.object. Strings can also be used in the style of select_dtypes (e.g. df.describe(exclude=['O'])). To exclude pandas categorical columns, use 'category' None (default) : The result will exclude nothing.
datetime_is_numeric:bool, default False

Whether to treat datetime dtypes as numeric. This affects statistics calculated for the column. For DataFrame input, this also controls whether datetime columns are included by default.  New in version 1.1.0.     Returns
 Series or DataFrame

Summary statistics of the Series or Dataframe provided.      See also  DataFrame.count

Count number of non-NA/null observations.  DataFrame.max

Maximum of the values in the object.  DataFrame.min

Minimum of the values in the object.  DataFrame.mean

Mean of the values.  DataFrame.std

Standard deviation of the observations.  DataFrame.select_dtypes

Subset of a DataFrame including/excluding columns based on their dtype.    Notes For numeric data, the result’s index will include count, mean, std, min, max as well as lower, 50 and upper percentiles. By default the lower percentile is 25 and the upper percentile is 75. The 50 percentile is the same as the median. For object data (e.g. strings or timestamps), the result’s index will include count, unique, top, and freq. The top is the most common value. The freq is the most common value’s frequency. Timestamps also include the first and last items. If multiple object values have the highest count, then the count and top results will be arbitrarily chosen from among those with the highest count. For mixed data types provided via a DataFrame, the default is to return only an analysis of numeric columns. If the dataframe consists only of object and categorical data without any numeric columns, the default is to return an analysis of both the object and categorical columns. If include='all' is provided as an option, the result will include a union of attributes of each type. The include and exclude parameters can be used to limit which columns in a DataFrame are analyzed for the output. The parameters are ignored when analyzing a Series. Examples Describing a numeric Series.
>>> s = pd.Series([1, 2, 3])
>>> s.describe()
count    3.0
mean     2.0
std      1.0
min      1.0
25%      1.5
50%      2.0
75%      2.5
max      3.0
dtype: float64
  Describing a categorical Series.
>>> s = pd.Series(['a', 'a', 'b', 'c'])
>>> s.describe()
count     4
unique    3
top       a
freq      2
dtype: object
  Describing a timestamp Series.
>>> s = pd.Series([
...   np.datetime64("2000-01-01"),
...   np.datetime64("2010-01-01"),
...   np.datetime64("2010-01-01")
... ])
>>> s.describe(datetime_is_numeric=True)
count                      3
mean     2006-09-01 08:00:00
min      2000-01-01 00:00:00
25%      2004-12-31 12:00:00
50%      2010-01-01 00:00:00
75%      2010-01-01 00:00:00
max      2010-01-01 00:00:00
dtype: object
  Describing a DataFrame. By default only numeric fields are returned.
>>> df = pd.DataFrame({'categorical': pd.Categorical(['d','e','f']),
...                    'numeric': [1, 2, 3],
...                    'object': ['a', 'b', 'c']
...                   })
>>> df.describe()
       numeric
count      3.0
mean       2.0
std        1.0
min        1.0
25%        1.5
50%        2.0
75%        2.5
max        3.0
  Describing all columns of a DataFrame regardless of data type.
>>> df.describe(include='all')
       categorical  numeric object
count            3      3.0      3
unique           3      NaN      3
top              f      NaN      a
freq             1      NaN      1
mean           NaN      2.0    NaN
std            NaN      1.0    NaN
min            NaN      1.0    NaN
25%            NaN      1.5    NaN
50%            NaN      2.0    NaN
75%            NaN      2.5    NaN
max            NaN      3.0    NaN
  Describing a column from a DataFrame by accessing it as an attribute.
>>> df.numeric.describe()
count    3.0
mean     2.0
std      1.0
min      1.0
25%      1.5
50%      2.0
75%      2.5
max      3.0
Name: numeric, dtype: float64
  Including only numeric columns in a DataFrame description.
>>> df.describe(include=[np.number])
       numeric
count      3.0
mean       2.0
std        1.0
min        1.0
25%        1.5
50%        2.0
75%        2.5
max        3.0
  Including only string columns in a DataFrame description.
>>> df.describe(include=[object])
       object
count       3
unique      3
top         a
freq        1
  Including only categorical columns from a DataFrame description.
>>> df.describe(include=['category'])
       categorical
count            3
unique           3
top              d
freq             1
  Excluding numeric columns from a DataFrame description.
>>> df.describe(exclude=[np.number])
       categorical object
count            3      3
unique           3      3
top              f      a
freq             1      1
  Excluding object columns from a DataFrame description.
>>> df.describe(exclude=[object])
       categorical  numeric
count            3      3.0
unique           3      NaN
top              f      NaN
freq             1      NaN
mean           NaN      2.0
std            NaN      1.0
min            NaN      1.0
25%            NaN      1.5
50%            NaN      2.0
75%            NaN      2.5
max            NaN      3.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.div   DataFrame.div(other, axis='columns', level=None, fill_value=None)[source]

Get Floating division of dataframe and other, element-wise (binary operator truediv). Equivalent to dataframe / other, but with support to substitute a fill_value for missing data in one of the inputs. With reverse version, rtruediv. Among flexible wrappers (add, sub, mul, div, mod, pow) to arithmetic operators: +, -, *, /, //, %, **.  Parameters

other:scalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.
axis:{0 or ‘index’, 1 or ‘columns’}

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’). For Series input, axis to match Series index on.
level:int or label

Broadcast across a level, matching Index values on the passed MultiIndex level.
fill_value:float or None, default None

Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.    Returns
 DataFrame

Result of the arithmetic operation.      See also  DataFrame.add

Add DataFrames.  DataFrame.sub

Subtract DataFrames.  DataFrame.mul

Multiply DataFrames.  DataFrame.div

Divide DataFrames (float division).  DataFrame.truediv

Divide DataFrames (float division).  DataFrame.floordiv

Divide DataFrames (integer division).  DataFrame.mod

Calculate modulo (remainder after division).  DataFrame.pow

Calculate exponential power.    Notes Mismatched indices will be unioned together. Examples
>>> df = pd.DataFrame({'angles': [0, 3, 4],
...                    'degrees': [360, 180, 360]},
...                   index=['circle', 'triangle', 'rectangle'])
>>> df
           angles  degrees
circle          0      360
triangle        3      180
rectangle       4      360
  Add a scalar with operator version which return the same results.
>>> df + 1
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361

>>> df.add(1)
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361
  Divide by constant with reverse version.
>>> df.div(10)
           angles  degrees
circle        0.0     36.0
triangle      0.3     18.0
rectangle     0.4     36.0

>>> df.rdiv(10)
             angles   degrees
circle          inf  0.027778
triangle   3.333333  0.055556
rectangle  2.500000  0.027778
  Subtract a list and Series by axis with operator version.
>>> df - [1, 2]
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub([1, 2], axis='columns')
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub(pd.Series([1, 1, 1], index=['circle', 'triangle', 'rectangle']),
...        axis='index')
           angles  degrees
circle         -1      359
triangle        2      179
rectangle       3      359
  Multiply a DataFrame of different shape with operator version.
>>> other = pd.DataFrame({'angles': [0, 3, 4]},
...                      index=['circle', 'triangle', 'rectangle'])
>>> other
           angles
circle          0
triangle        3
rectangle       4

>>> df * other
           angles  degrees
circle          0      NaN
triangle        9      NaN
rectangle      16      NaN

>>> df.mul(other, fill_value=0)
           angles  degrees
circle          0      0.0
triangle        9      0.0
rectangle      16      0.0
  Divide by a MultiIndex by level.
>>> df_multindex = pd.DataFrame({'angles': [0, 3, 4, 4, 5, 6],
...                              'degrees': [360, 180, 360, 360, 540, 720]},
...                             index=[['A', 'A', 'A', 'B', 'B', 'B'],
...                                    ['circle', 'triangle', 'rectangle',
...                                     'square', 'pentagon', 'hexagon']])
>>> df_multindex
             angles  degrees
A circle          0      360
  triangle        3      180
  rectangle       4      360
B square          4      360
  pentagon        5      540
  hexagon         6      720

>>> df.div(df_multindex, level=1, fill_value=0)
             angles  degrees
A circle        NaN      1.0
  triangle      1.0      1.0
  rectangle     1.0      1.0
B square        0.0      0.0
  pentagon      0.0      0.0
  hexagon       0.0      0.0


pandas.DataFrame.divide   DataFrame.divide(other, axis='columns', level=None, fill_value=None)[source]

Get Floating division of dataframe and other, element-wise (binary operator truediv). Equivalent to dataframe / other, but with support to substitute a fill_value for missing data in one of the inputs. With reverse version, rtruediv. Among flexible wrappers (add, sub, mul, div, mod, pow) to arithmetic operators: +, -, *, /, //, %, **.  Parameters

other:scalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.
axis:{0 or ‘index’, 1 or ‘columns’}

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’). For Series input, axis to match Series index on.
level:int or label

Broadcast across a level, matching Index values on the passed MultiIndex level.
fill_value:float or None, default None

Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.    Returns
 DataFrame

Result of the arithmetic operation.      See also  DataFrame.add

Add DataFrames.  DataFrame.sub

Subtract DataFrames.  DataFrame.mul

Multiply DataFrames.  DataFrame.div

Divide DataFrames (float division).  DataFrame.truediv

Divide DataFrames (float division).  DataFrame.floordiv

Divide DataFrames (integer division).  DataFrame.mod

Calculate modulo (remainder after division).  DataFrame.pow

Calculate exponential power.    Notes Mismatched indices will be unioned together. Examples
>>> df = pd.DataFrame({'angles': [0, 3, 4],
...                    'degrees': [360, 180, 360]},
...                   index=['circle', 'triangle', 'rectangle'])
>>> df
           angles  degrees
circle          0      360
triangle        3      180
rectangle       4      360
  Add a scalar with operator version which return the same results.
>>> df + 1
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361

>>> df.add(1)
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361
  Divide by constant with reverse version.
>>> df.div(10)
           angles  degrees
circle        0.0     36.0
triangle      0.3     18.0
rectangle     0.4     36.0

>>> df.rdiv(10)
             angles   degrees
circle          inf  0.027778
triangle   3.333333  0.055556
rectangle  2.500000  0.027778
  Subtract a list and Series by axis with operator version.
>>> df - [1, 2]
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub([1, 2], axis='columns')
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub(pd.Series([1, 1, 1], index=['circle', 'triangle', 'rectangle']),
...        axis='index')
           angles  degrees
circle         -1      359
triangle        2      179
rectangle       3      359
  Multiply a DataFrame of different shape with operator version.
>>> other = pd.DataFrame({'angles': [0, 3, 4]},
...                      index=['circle', 'triangle', 'rectangle'])
>>> other
           angles
circle          0
triangle        3
rectangle       4

>>> df * other
           angles  degrees
circle          0      NaN
triangle        9      NaN
rectangle      16      NaN

>>> df.mul(other, fill_value=0)
           angles  degrees
circle          0      0.0
triangle        9      0.0
rectangle      16      0.0
  Divide by a MultiIndex by level.
>>> df_multindex = pd.DataFrame({'angles': [0, 3, 4, 4, 5, 6],
...                              'degrees': [360, 180, 360, 360, 540, 720]},
...                             index=[['A', 'A', 'A', 'B', 'B', 'B'],
...                                    ['circle', 'triangle', 'rectangle',
...                                     'square', 'pentagon', 'hexagon']])
>>> df_multindex
             angles  degrees
A circle          0      360
  triangle        3      180
  rectangle       4      360
B square          4      360
  pentagon        5      540
  hexagon         6      720

>>> df.div(df_multindex, level=1, fill_value=0)
             angles  degrees
A circle        NaN      1.0
  triangle      1.0      1.0
  rectangle     1.0      1.0
B square        0.0      0.0
  pentagon      0.0      0.0
  hexagon       0.0      0.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   DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')[source]

Drop specified labels from rows or columns. Remove rows or columns by specifying label names and corresponding axis, or by specifying directly index or column names. When using a multi-index, labels on different levels can be removed by specifying the level. See the user guide <advanced.shown_levels> for more information about the now unused levels.  Parameters

labels:single label or list-like

Index or column labels to drop. A tuple will be used as a single label and not treated as a list-like.
axis:{0 or ‘index’, 1 or ‘columns’}, default 0

Whether to drop labels from the index (0 or ‘index’) or columns (1 or ‘columns’).
index:single label or list-like

Alternative to specifying axis (labels, axis=0 is equivalent to index=labels).
columns:single label or list-like

Alternative to specifying axis (labels, axis=1 is equivalent to columns=labels).
level:int or level name, optional

For MultiIndex, level from which the labels will be removed.
inplace:bool, default False

If False, return a copy. Otherwise, do operation inplace and return None.
errors:{‘ignore’, ‘raise’}, default ‘raise’

If ‘ignore’, suppress error and only existing labels are dropped.    Returns
 DataFrame or None

DataFrame without the removed index or column labels or None if inplace=True.    Raises
 KeyError

If any of the labels is not found in the selected axis.      See also  DataFrame.loc

Label-location based indexer for selection by label.  DataFrame.dropna

Return DataFrame with labels on given axis omitted where (all or any) data are missing.  DataFrame.drop_duplicates

Return DataFrame with duplicate rows removed, optionally only considering certain columns.  Series.drop

Return Series with specified index labels removed.    Examples
>>> df = pd.DataFrame(np.arange(12).reshape(3, 4),
...                   columns=['A', 'B', 'C', 'D'])
>>> df
   A  B   C   D
0  0  1   2   3
1  4  5   6   7
2  8  9  10  11
  Drop columns
>>> df.drop(['B', 'C'], axis=1)
   A   D
0  0   3
1  4   7
2  8  11

>>> df.drop(columns=['B', 'C'])
   A   D
0  0   3
1  4   7
2  8  11
  Drop a row by index
>>> df.drop([0, 1])
   A  B   C   D
2  8  9  10  11
  Drop columns and/or rows of MultiIndex DataFrame
>>> midx = pd.MultiIndex(levels=[['lama', 'cow', 'falcon'],
...                              ['speed', 'weight', 'length']],
...                      codes=[[0, 0, 0, 1, 1, 1, 2, 2, 2],
...                             [0, 1, 2, 0, 1, 2, 0, 1, 2]])
>>> df = pd.DataFrame(index=midx, columns=['big', 'small'],
...                   data=[[45, 30], [200, 100], [1.5, 1], [30, 20],
...                         [250, 150], [1.5, 0.8], [320, 250],
...                         [1, 0.8], [0.3, 0.2]])
>>> df
                big     small
lama    speed   45.0    30.0
        weight  200.0   100.0
        length  1.5     1.0
cow     speed   30.0    20.0
        weight  250.0   150.0
        length  1.5     0.8
falcon  speed   320.0   250.0
        weight  1.0     0.8
        length  0.3     0.2
  Drop a specific index combination from the MultiIndex DataFrame, i.e., drop the combination 'falcon' and 'weight', which deletes only the corresponding row
>>> df.drop(index=('falcon', 'weight'))
                big     small
lama    speed   45.0    30.0
        weight  200.0   100.0
        length  1.5     1.0
cow     speed   30.0    20.0
        weight  250.0   150.0
        length  1.5     0.8
falcon  speed   320.0   250.0
        length  0.3     0.2

>>> df.drop(index='cow', columns='small')
                big
lama    speed   45.0
        weight  200.0
        length  1.5
falcon  speed   320.0
        weight  1.0
        length  0.3

>>> df.drop(index='length', level=1)
                big     small
lama    speed   45.0    30.0
        weight  200.0   100.0
cow     speed   30.0    20.0
        weight  250.0   150.0
falcon  speed   320.0   250.0
        weight  1.0     0.8


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.eq   DataFrame.eq(other, axis='columns', level=None)[source]

Get Equal to of dataframe and other, element-wise (binary operator eq). Among flexible wrappers (eq, ne, le, lt, ge, gt) to comparison operators. Equivalent to ==, !=, <=, <, >=, > with support to choose axis (rows or columns) and level for comparison.  Parameters

other:scalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.
axis:{0 or ‘index’, 1 or ‘columns’}, default ‘columns’

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’).
level:int or label

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 DataFrame of bool

Result of the comparison.      See also  DataFrame.eq

Compare DataFrames for equality elementwise.  DataFrame.ne

Compare DataFrames for inequality elementwise.  DataFrame.le

Compare DataFrames for less than inequality or equality elementwise.  DataFrame.lt

Compare DataFrames for strictly less than inequality elementwise.  DataFrame.ge

Compare DataFrames for greater than inequality or equality elementwise.  DataFrame.gt

Compare DataFrames for strictly greater than inequality elementwise.    Notes Mismatched indices will be unioned together. NaN values are considered different (i.e. NaN != NaN). Examples
>>> df = pd.DataFrame({'cost': [250, 150, 100],
...                    'revenue': [100, 250, 300]},
...                   index=['A', 'B', 'C'])
>>> df
   cost  revenue
A   250      100
B   150      250
C   100      300
  Comparison with a scalar, using either the operator or method:
>>> df == 100
    cost  revenue
A  False     True
B  False    False
C   True    False

>>> df.eq(100)
    cost  revenue
A  False     True
B  False    False
C   True    False
  When other is a Series, the columns of a DataFrame are aligned with the index of other and broadcast:
>>> df != pd.Series([100, 250], index=["cost", "revenue"])
    cost  revenue
A   True     True
B   True    False
C  False     True
  Use the method to control the broadcast axis:
>>> df.ne(pd.Series([100, 300], index=["A", "D"]), axis='index')
   cost  revenue
A  True    False
B  True     True
C  True     True
D  True     True
  When comparing to an arbitrary sequence, the number of columns must match the number elements in other:
>>> df == [250, 100]
    cost  revenue
A   True     True
B  False    False
C  False    False
  Use the method to control the axis:
>>> df.eq([250, 250, 100], axis='index')
    cost  revenue
A   True    False
B  False     True
C   True    False
  Compare to a DataFrame of different shape.
>>> other = pd.DataFrame({'revenue': [300, 250, 100, 150]},
...                      index=['A', 'B', 'C', 'D'])
>>> other
   revenue
A      300
B      250
C      100
D      150

>>> df.gt(other)
    cost  revenue
A  False    False
B  False    False
C  False     True
D  False    False
  Compare to a MultiIndex by level.
>>> df_multindex = pd.DataFrame({'cost': [250, 150, 100, 150, 300, 220],
...                              'revenue': [100, 250, 300, 200, 175, 225]},
...                             index=[['Q1', 'Q1', 'Q1', 'Q2', 'Q2', 'Q2'],
...                                    ['A', 'B', 'C', 'A', 'B', 'C']])
>>> df_multindex
      cost  revenue
Q1 A   250      100
   B   150      250
   C   100      300
Q2 A   150      200
   B   300      175
   C   220      225

>>> df.le(df_multindex, level=1)
       cost  revenue
Q1 A   True     True
   B   True     True
   C   True     True
Q2 A  False     True
   B   True    False
   C   True    False


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.ewm   DataFrame.ewm(com=None, span=None, halflife=None, alpha=None, min_periods=0, adjust=True, ignore_na=False, axis=0, times=None, method='single')[source]

Provide exponentially weighted (EW) calculations. Exactly one parameter: com, span, halflife, or alpha must be provided.  Parameters

com:float, optional

Specify decay in terms of center of mass \(\alpha = 1 / (1 + com)\), for \(com \geq 0\).
span:float, optional

Specify decay in terms of span \(\alpha = 2 / (span + 1)\), for \(span \geq 1\).
halflife:float, str, timedelta, optional

Specify decay in terms of half-life \(\alpha = 1 - \exp\left(-\ln(2) / halflife\right)\), for \(halflife > 0\). If times is specified, the time unit (str or timedelta) over which an observation decays to half its value. Only applicable to mean(), and halflife value will not apply to the other functions.  New in version 1.1.0.
alpha:float, optional

Specify smoothing factor \(\alpha\) directly \(0 < \alpha \leq 1\).
min_periods:int, default 0

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

Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings (viewing EWMA as a moving average).  When adjust=True (default), the EW function is calculated using weights \(w_i = (1 - \alpha)^i\). For example, the EW moving average of the series [\(x_0, x_1, ..., x_t\)] would be:   \[y_t = \frac{x_t + (1 - \alpha)x_{t-1} + (1 - \alpha)^2 x_{t-2} + ... + (1 - \alpha)^t x_0}{1 + (1 - \alpha) + (1 - \alpha)^2 + ... + (1 - \alpha)^t}\]  When adjust=False, the exponentially weighted function is calculated recursively:   \[\begin{split}\begin{split} y_0 &= x_0\\ y_t &= (1 - \alpha) y_{t-1} + \alpha x_t, \end{split}\end{split}\]
ignore_na:bool, default False

Ignore missing values when calculating weights.  When ignore_na=False (default), weights are based on absolute positions. For example, the weights of \(x_0\) and \(x_2\) used in calculating the final weighted average of [\(x_0\), None, \(x_2\)] are \((1-\alpha)^2\) and \(1\) if adjust=True, and \((1-\alpha)^2\) and \(\alpha\) if adjust=False. When ignore_na=True, weights are based on relative positions. For example, the weights of \(x_0\) and \(x_2\) used in calculating the final weighted average of [\(x_0\), None, \(x_2\)] are \(1-\alpha\) and \(1\) if adjust=True, and \(1-\alpha\) and \(\alpha\) if adjust=False.
axis:{0, 1}, default 0

If 0 or 'index', calculate across the rows. If 1 or 'columns', calculate across the columns.
times:str, np.ndarray, Series, default None

 New in version 1.1.0.  Only applicable to mean(). Times corresponding to the observations. Must be monotonically increasing and datetime64[ns] dtype. If 1-D array like, a sequence with the same shape as the observations.  Deprecated since version 1.4.0: If str, the name of the column in the DataFrame representing the times.
method:str {‘single’, ‘table’}, default ‘single’

 New in version 1.4.0.  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. Only applicable to mean()    Returns

ExponentialMovingWindow subclass
    See also  rolling

Provides rolling window calculations.  expanding

Provides expanding transformations.    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

>>> df.ewm(com=0.5).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
>>> df.ewm(alpha=2 / 3).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
  adjust
>>> df.ewm(com=0.5, adjust=True).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
>>> df.ewm(com=0.5, adjust=False).mean()
          B
0  0.000000
1  0.666667
2  1.555556
3  1.555556
4  3.650794
  ignore_na
>>> df.ewm(com=0.5, ignore_na=True).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.225000
>>> df.ewm(com=0.5, ignore_na=False).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
  times Exponentially weighted mean with weights calculated with a timedelta halflife relative to times.
>>> times = ['2020-01-01', '2020-01-03', '2020-01-10', '2020-01-15', '2020-01-17']
>>> df.ewm(halflife='4 days', times=pd.DatetimeIndex(times)).mean()
          B
0  0.000000
1  0.585786
2  1.523889
3  1.523889
4  3.233686


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.


pandas.DataFrame.fillna   DataFrame.fillna(value=None, method=None, axis=None, inplace=False, limit=None, downcast=None)[source]

Fill NA/NaN values using the specified method.  Parameters

value:scalar, dict, Series, or DataFrame

Value to use to fill holes (e.g. 0), alternately a dict/Series/DataFrame of values specifying which value to use for each index (for a Series) or column (for a DataFrame). Values not in the dict/Series/DataFrame will not be filled. This value cannot be a list.
method:{‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}, default None

Method to use for filling holes in reindexed Series pad / ffill: propagate last valid observation forward to next valid backfill / bfill: use next valid observation to fill gap.
axis:{0 or ‘index’, 1 or ‘columns’}

Axis along which to fill missing values.
inplace:bool, default False

If True, fill in-place. Note: this will modify any other views on this object (e.g., a no-copy slice for a column in a DataFrame).
limit:int, default None

If method is specified, this is the maximum number of consecutive NaN values to forward/backward fill. In other words, if there is a gap with more than this number of consecutive NaNs, it will only be partially filled. If method is not specified, this is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None.
downcast:dict, default is None

A dict of item->dtype of what to downcast if possible, or the string ‘infer’ which will try to downcast to an appropriate equal type (e.g. float64 to int64 if possible).    Returns
 DataFrame or None

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

Fill NaN values using interpolation.  reindex

Conform object to new index.  asfreq

Convert TimeSeries to specified frequency.    Examples
>>> df = pd.DataFrame([[np.nan, 2, np.nan, 0],
...                    [3, 4, np.nan, 1],
...                    [np.nan, np.nan, np.nan, np.nan],
...                    [np.nan, 3, np.nan, 4]],
...                   columns=list("ABCD"))
>>> df
     A    B   C    D
0  NaN  2.0 NaN  0.0
1  3.0  4.0 NaN  1.0
2  NaN  NaN NaN  NaN
3  NaN  3.0 NaN  4.0
  Replace all NaN elements with 0s.
>>> df.fillna(0)
     A    B    C    D
0  0.0  2.0  0.0  0.0
1  3.0  4.0  0.0  1.0
2  0.0  0.0  0.0  0.0
3  0.0  3.0  0.0  4.0
  We can also propagate non-null values forward or backward.
>>> df.fillna(method="ffill")
     A    B   C    D
0  NaN  2.0 NaN  0.0
1  3.0  4.0 NaN  1.0
2  3.0  4.0 NaN  1.0
3  3.0  3.0 NaN  4.0
  Replace all NaN elements in column ‘A’, ‘B’, ‘C’, and ‘D’, with 0, 1, 2, and 3 respectively.
>>> values = {"A": 0, "B": 1, "C": 2, "D": 3}
>>> df.fillna(value=values)
     A    B    C    D
0  0.0  2.0  2.0  0.0
1  3.0  4.0  2.0  1.0
2  0.0  1.0  2.0  3.0
3  0.0  3.0  2.0  4.0
  Only replace the first NaN element.
>>> df.fillna(value=values, limit=1)
     A    B    C    D
0  0.0  2.0  2.0  0.0
1  3.0  4.0  NaN  1.0
2  NaN  1.0  NaN  3.0
3  NaN  3.0  NaN  4.0
  When filling using a DataFrame, replacement happens along the same column names and same indices
>>> df2 = pd.DataFrame(np.zeros((4, 4)), columns=list("ABCE"))
>>> df.fillna(df2)
     A    B    C    D
0  0.0  2.0  0.0  0.0
1  3.0  4.0  0.0  1.0
2  0.0  0.0  0.0  NaN
3  0.0  3.0  0.0  4.0
  Note that column D is not affected since it is not present in df2.


pandas.DataFrame.filter   DataFrame.filter(items=None, like=None, regex=None, axis=None)[source]

Subset the dataframe rows or columns according to the specified index labels. Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index.  Parameters

items:list-like

Keep labels from axis which are in items.
like:str

Keep labels from axis for which “like in label == True”.
regex:str (regular expression)

Keep labels from axis for which re.search(regex, label) == True.
axis:{0 or ‘index’, 1 or ‘columns’, None}, default None

The axis to filter on, expressed either as an index (int) or axis name (str). By default this is the info axis, ‘index’ for Series, ‘columns’ for DataFrame.    Returns
 same type as input object
    See also  DataFrame.loc

Access a group of rows and columns by label(s) or a boolean array.    Notes The items, like, and regex parameters are enforced to be mutually exclusive. axis defaults to the info axis that is used when indexing with []. Examples
>>> df = pd.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),
...                   index=['mouse', 'rabbit'],
...                   columns=['one', 'two', 'three'])
>>> df
        one  two  three
mouse     1    2      3
rabbit    4    5      6

>>> # select columns by name
>>> df.filter(items=['one', 'three'])
         one  three
mouse     1      3
rabbit    4      6

>>> # select columns by regular expression
>>> df.filter(regex='e$', axis=1)
         one  three
mouse     1      3
rabbit    4      6

>>> # select rows containing 'bbi'
>>> df.filter(like='bbi', axis=0)
         one  two  three
rabbit    4    5      6


pandas.DataFrame.first   DataFrame.first(offset)[source]

Select initial periods of time series data based on a date offset. When having a DataFrame with dates as index, this function can select the first few rows based on a date offset.  Parameters

offset:str, DateOffset or dateutil.relativedelta

The offset length of the data that will be selected. For instance, ‘1M’ will display all the rows having their index within the first month.    Returns
 Series or DataFrame

A subset of the caller.    Raises
 TypeError

If the index is not a DatetimeIndex      See also  last

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

Select values at a particular time of the day.  between_time

Select values between particular times of the day.    Examples
>>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
            A
2018-04-09  1
2018-04-11  2
2018-04-13  3
2018-04-15  4
  Get the rows for the first 3 days:
>>> ts.first('3D')
            A
2018-04-09  1
2018-04-11  2
  Notice the data for 3 first calendar days were returned, not the first 3 days observed in the dataset, and therefore data for 2018-04-13 was not returned.


pandas.DataFrame.first_valid_index   DataFrame.first_valid_index()[source]

Return index for first non-NA value or None, if no NA value is found.  Returns

scalar:type of index

   Notes If all elements are non-NA/null, returns None. Also returns None for empty Series/DataFrame.


pandas.DataFrame.flags   propertyDataFrame.flags

Get the properties associated with this pandas object. The available flags are  Flags.allows_duplicate_labels   See also  Flags

Flags that apply to pandas objects.  DataFrame.attrs

Global metadata applying to this dataset.    Notes “Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs. Examples
>>> df = pd.DataFrame({"A": [1, 2]})
>>> df.flags
<Flags(allows_duplicate_labels=True)>
  Flags can be get or set using .
>>> df.flags.allows_duplicate_labels
True
>>> df.flags.allows_duplicate_labels = False
  Or by slicing with a key
>>> df.flags["allows_duplicate_labels"]
False
>>> df.flags["allows_duplicate_labels"] = True


pandas.DataFrame.floordiv   DataFrame.floordiv(other, axis='columns', level=None, fill_value=None)[source]

Get Integer division of dataframe and other, element-wise (binary operator floordiv). Equivalent to dataframe // other, but with support to substitute a fill_value for missing data in one of the inputs. With reverse version, rfloordiv. Among flexible wrappers (add, sub, mul, div, mod, pow) to arithmetic operators: +, -, *, /, //, %, **.  Parameters

other:scalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.
axis:{0 or ‘index’, 1 or ‘columns’}

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’). For Series input, axis to match Series index on.
level:int or label

Broadcast across a level, matching Index values on the passed MultiIndex level.
fill_value:float or None, default None

Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.    Returns
 DataFrame

Result of the arithmetic operation.      See also  DataFrame.add

Add DataFrames.  DataFrame.sub

Subtract DataFrames.  DataFrame.mul

Multiply DataFrames.  DataFrame.div

Divide DataFrames (float division).  DataFrame.truediv

Divide DataFrames (float division).  DataFrame.floordiv

Divide DataFrames (integer division).  DataFrame.mod

Calculate modulo (remainder after division).  DataFrame.pow

Calculate exponential power.    Notes Mismatched indices will be unioned together. Examples
>>> df = pd.DataFrame({'angles': [0, 3, 4],
...                    'degrees': [360, 180, 360]},
...                   index=['circle', 'triangle', 'rectangle'])
>>> df
           angles  degrees
circle          0      360
triangle        3      180
rectangle       4      360
  Add a scalar with operator version which return the same results.
>>> df + 1
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361

>>> df.add(1)
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361
  Divide by constant with reverse version.
>>> df.div(10)
           angles  degrees
circle        0.0     36.0
triangle      0.3     18.0
rectangle     0.4     36.0

>>> df.rdiv(10)
             angles   degrees
circle          inf  0.027778
triangle   3.333333  0.055556
rectangle  2.500000  0.027778
  Subtract a list and Series by axis with operator version.
>>> df - [1, 2]
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub([1, 2], axis='columns')
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358

>>> df.sub(pd.Series([1, 1, 1], index=['circle', 'triangle', 'rectangle']),
...        axis='index')
           angles  degrees
circle         -1      359
triangle        2      179
rectangle       3      359
  Multiply a DataFrame of different shape with operator version.
>>> other = pd.DataFrame({'angles': [0, 3, 4]},
...                      index=['circle', 'triangle', 'rectangle'])
>>> other
           angles
circle          0
triangle        3
rectangle       4

>>> df * other
           angles  degrees
circle          0      NaN
triangle        9      NaN
rectangle      16      NaN

>>> df.mul(other, fill_value=0)
           angles  degrees
circle          0      0.0
triangle        9      0.0
rectangle      16      0.0
  Divide by a MultiIndex by level.
>>> df_multindex = pd.DataFrame({'angles': [0, 3, 4, 4, 5, 6],
...                              'degrees': [360, 180, 360, 360, 540, 720]},
...                             index=[['A', 'A', 'A', 'B', 'B', 'B'],
...                                    ['circle', 'triangle', 'rectangle',
...                                     'square', 'pentagon', 'hexagon']])
>>> df_multindex
             angles  degrees
A circle          0      360
  triangle        3      180
  rectangle       4      360
B square          4      360
  pentagon        5      540
  hexagon         6      720

>>> df.div(df_multindex, level=1, fill_value=0)
             angles  degrees
A circle        NaN      1.0
  triangle      1.0      1.0
  rectangle     1.0      1.0
B square        0.0      0.0
  pentagon      0.0      0.0
  hexagon       0.0      0.0


pandas.DataFrame.from_dict   classmethodDataFrame.from_dict(data, orient='columns', dtype=None, columns=None)[source]

Construct DataFrame from dict of array-like or dicts. Creates DataFrame object from dictionary by columns or by index allowing dtype specification.  Parameters

data:dict

Of the form {field : array-like} or {field : dict}.
orient:{‘columns’, ‘index’, ‘tight’}, default ‘columns’

The “orientation” of the data. If the keys of the passed dict should be the columns of the resulting DataFrame, pass ‘columns’ (default). Otherwise if the keys should be rows, pass ‘index’. If ‘tight’, assume a dict with keys [‘index’, ‘columns’, ‘data’, ‘index_names’, ‘column_names’].  New in version 1.4.0: ‘tight’ as an allowed value for the orient argument
dtype:dtype, default None

Data type to force, otherwise infer.
columns:list, default None

Column labels to use when orient='index'. Raises a ValueError if used with orient='columns' or orient='tight'.    Returns
 DataFrame
    See also  DataFrame.from_records

DataFrame from structured ndarray, sequence of tuples or dicts, or DataFrame.  DataFrame

DataFrame object creation using constructor.  DataFrame.to_dict

Convert the DataFrame to a dictionary.    Examples By default the keys of the dict become the DataFrame columns:
>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d
  Specify orient='index' to create the DataFrame using dictionary keys as rows:
>>> data = {'row_1': [3, 2, 1, 0], 'row_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data, orient='index')
       0  1  2  3
row_1  3  2  1  0
row_2  a  b  c  d
  When using the ‘index’ orientation, the column names can be specified manually:
>>> pd.DataFrame.from_dict(data, orient='index',
...                        columns=['A', 'B', 'C', 'D'])
       A  B  C  D
row_1  3  2  1  0
row_2  a  b  c  d
  Specify orient='tight' to create the DataFrame using a ‘tight’ format:
>>> data = {'index': [('a', 'b'), ('a', 'c')],
...         'columns': [('x', 1), ('y', 2)],
...         'data': [[1, 3], [2, 4]],
...         'index_names': ['n1', 'n2'],
...         'column_names': ['z1', 'z2']}
>>> pd.DataFrame.from_dict(data, orient='tight')
z1     x  y
z2     1  2
n1 n2
a  b   1  3
   c   2  4


pandas.DataFrame.from_records   classmethodDataFrame.from_records(data, index=None, exclude=None, columns=None, coerce_float=False, nrows=None)[source]

Convert structured or record ndarray to DataFrame. Creates a DataFrame object from a structured ndarray, sequence of tuples or dicts, or DataFrame.  Parameters

data:structured ndarray, sequence of tuples or dicts, or DataFrame

Structured input data.
index:str, list of fields, array-like

Field of array to use as the index, alternately a specific set of input labels to use.
exclude:sequence, default None

Columns or fields to exclude.
columns:sequence, default None

Column names to use. If the passed data do not have names associated with them, this argument provides names for the columns. Otherwise this argument indicates the order of the columns in the result (any names not found in the data will become all-NA columns).
coerce_float:bool, default False

Attempt to convert values of non-string, non-numeric objects (like decimal.Decimal) to floating point, useful for SQL result sets.
nrows:int, default None

Number of rows to read if data is an iterator.    Returns
 DataFrame
    See also  DataFrame.from_dict

DataFrame from dict of array-like or dicts.  DataFrame

DataFrame object creation using constructor.    Examples Data can be provided as a structured ndarray:
>>> data = np.array([(3, 'a'), (2, 'b'), (1, 'c'), (0, 'd')],
...                 dtype=[('col_1', 'i4'), ('col_2', 'U1')])
>>> pd.DataFrame.from_records(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d
  Data can be provided as a list of dicts:
>>> data = [{'col_1': 3, 'col_2': 'a'},
...         {'col_1': 2, 'col_2': 'b'},
...         {'col_1': 1, 'col_2': 'c'},
...         {'col_1': 0, 'col_2': 'd'}]
>>> pd.DataFrame.from_records(data)
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d
  Data can be provided as a list of tuples with corresponding columns:
>>> data = [(3, 'a'), (2, 'b'), (1, 'c'), (0, 'd')]
>>> pd.DataFrame.from_records(data, columns=['col_1', 'col_2'])
   col_1 col_2
0      3     a
1      2     b
2      1     c
3      0     d


pandas.DataFrame.ge   DataFrame.ge(other, axis='columns', level=None)[source]

Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). Among flexible wrappers (eq, ne, le, lt, ge, gt) to comparison operators. Equivalent to ==, !=, <=, <, >=, > with support to choose axis (rows or columns) and level for comparison.  Parameters

other:scalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.
axis:{0 or ‘index’, 1 or ‘columns’}, default ‘columns’

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’).
level:int or label

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 DataFrame of bool

Result of the comparison.      See also  DataFrame.eq

Compare DataFrames for equality elementwise.  DataFrame.ne

Compare DataFrames for inequality elementwise.  DataFrame.le

Compare DataFrames for less than inequality or equality elementwise.  DataFrame.lt

Compare DataFrames for strictly less than inequality elementwise.  DataFrame.ge

Compare DataFrames for greater than inequality or equality elementwise.  DataFrame.gt

Compare DataFrames for strictly greater than inequality elementwise.    Notes Mismatched indices will be unioned together. NaN values are considered different (i.e. NaN != NaN). Examples
>>> df = pd.DataFrame({'cost': [250, 150, 100],
...                    'revenue': [100, 250, 300]},
...                   index=['A', 'B', 'C'])
>>> df
   cost  revenue
A   250      100
B   150      250
C   100      300
  Comparison with a scalar, using either the operator or method:
>>> df == 100
    cost  revenue
A  False     True
B  False    False
C   True    False

>>> df.eq(100)
    cost  revenue
A  False     True
B  False    False
C   True    False
  When other is a Series, the columns of a DataFrame are aligned with the index of other and broadcast:
>>> df != pd.Series([100, 250], index=["cost", "revenue"])
    cost  revenue
A   True     True
B   True    False
C  False     True
  Use the method to control the broadcast axis:
>>> df.ne(pd.Series([100, 300], index=["A", "D"]), axis='index')
   cost  revenue
A  True    False
B  True     True
C  True     True
D  True     True
  When comparing to an arbitrary sequence, the number of columns must match the number elements in other:
>>> df == [250, 100]
    cost  revenue
A   True     True
B  False    False
C  False    False
  Use the method to control the axis:
>>> df.eq([250, 250, 100], axis='index')
    cost  revenue
A   True    False
B  False     True
C   True    False
  Compare to a DataFrame of different shape.
>>> other = pd.DataFrame({'revenue': [300, 250, 100, 150]},
...                      index=['A', 'B', 'C', 'D'])
>>> other
   revenue
A      300
B      250
C      100
D      150

>>> df.gt(other)
    cost  revenue
A  False    False
B  False    False
C  False     True
D  False    False
  Compare to a MultiIndex by level.
>>> df_multindex = pd.DataFrame({'cost': [250, 150, 100, 150, 300, 220],
...                              'revenue': [100, 250, 300, 200, 175, 225]},
...                             index=[['Q1', 'Q1', 'Q1', 'Q2', 'Q2', 'Q2'],
...                                    ['A', 'B', 'C', 'A', 'B', 'C']])
>>> df_multindex
      cost  revenue
Q1 A   250      100
   B   150      250
   C   100      300
Q2 A   150      200
   B   300      175
   C   220      225

>>> df.le(df_multindex, level=1)
       cost  revenue
Q1 A   True     True
   B   True     True
   C   True     True
Q2 A  False     True
   B   True    False
   C   True    False


pandas.DataFrame.get   DataFrame.get(key, default=None)[source]

Get item from object for given key (ex: DataFrame column). Returns default value if not found.  Parameters

key:object

  Returns

value:same type as items contained in object

   Examples
>>> df = pd.DataFrame(
...     [
...         [24.3, 75.7, "high"],
...         [31, 87.8, "high"],
...         [22, 71.6, "medium"],
...         [35, 95, "medium"],
...     ],
...     columns=["temp_celsius", "temp_fahrenheit", "windspeed"],
...     index=pd.date_range(start="2014-02-12", end="2014-02-15", freq="D"),
... )

>>> df
            temp_celsius  temp_fahrenheit windspeed
2014-02-12          24.3             75.7      high
2014-02-13          31.0             87.8      high
2014-02-14          22.0             71.6    medium
2014-02-15          35.0             95.0    medium

>>> df.get(["temp_celsius", "windspeed"])
            temp_celsius windspeed
2014-02-12          24.3      high
2014-02-13          31.0      high
2014-02-14          22.0    medium
2014-02-15          35.0    medium
  If the key isn’t found, the default value will be used.
>>> df.get(["temp_celsius", "temp_kelvin"], default="default_value")
'default_value'