mteb/BrightProStackoverflowRetrieval huggingface dataset:
.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.notnull  #

DataFrame.  notnull  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L6505-L6510) #

    

DataFrame.notnull is an alias for DataFrame.notna.

Detect existing (non-missing) values.

Return a boolean same-sized object indicating if the values are not NA. Non-
missing values get mapped to True. Characters such as empty strings ` ''  ` or
` numpy.inf  ` are not considered NA values (unless you set `
pandas.options.mode.use_inf_as_na  =  True  ` ). NA values, such as None or `
numpy.NaN  ` , get mapped to False values.

Returns  :

    

DataFrame

    

Mask of bool values for each element in DataFrame that indicates whether an
element is not an NA value.

See also

` DataFrame.notnull  `

    

Alias of notna.

[ ` DataFrame.isna  ` ](pandas.DataFrame.isna.html#pandas.DataFrame.isna
"pandas.DataFrame.isna")

    

Boolean inverse of notna.

[ ` DataFrame.dropna  ` ](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna
"pandas.DataFrame.dropna")

    

Omit axes labels with missing values.

[ ` notna  ` ](pandas.notna.html#pandas.notna "pandas.notna")

    

Top-level notna.

Examples

Show which entries in a DataFrame are not NA.

    
    
    >>> df = pd.DataFrame(dict(age=[5, 6, np.nan],
    ...                        born=[pd.NaT, pd.Timestamp('1939-05-27'),
    ...                              pd.Timestamp('1940-04-25')],
    ...                        name=['Alfred', 'Batman', ''],
    ...                        toy=[None, 'Batmobile', 'Joker']))
    >>> df
       age       born    name        toy
    0  5.0        NaT  Alfred       None
    1  6.0 1939-05-27  Batman  Batmobile
    2  NaN 1940-04-25              Joker
    
    
    
    >>> df.notna()
         age   born  name    toy
    0   True  False  True  False
    1   True   True  True   True
    2  False   True  True   True
    

Show which entries in a Series are not NA.

    
    
    >>> ser = pd.Series([5, 6, np.nan])
    >>> ser
    0    5.0
    1    6.0
    2    NaN
    dtype: float64
    
    
    
    >>> ser.notna()
    0     True
    1     True
    2    False
    dtype: bool
    

[ __ previous  pandas.DataFrame.notna  ](pandas.DataFrame.notna.html "previous
page") [ next  pandas.DataFrame.pad  __ ](pandas.DataFrame.pad.html "next
page")

__ On this page

  * ` DataFrame.notnull()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.notnull.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.quarter  #

_ property  _ PeriodIndex.  quarter  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

The quarter of the date.

Examples

    
    
    >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
    >>> idx.quarter
    Index([1, 1, 1], dtype='int64')
    

[ __ previous  pandas.PeriodIndex.month  ](pandas.PeriodIndex.month.html
"previous page") [ next  pandas.PeriodIndex.second  __
](pandas.PeriodIndex.second.html "next page")

__ On this page

  * ` PeriodIndex.quarter  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.quarter.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
ields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.get_loc_level  #

MultiIndex.  get_loc_level  (  _ key  _ , _ level  =  0  _ , _ drop_level  =
True  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L3104-L3157) #

    

Get location and sliced index for requested label(s)/level(s).

Parameters  :

    

**key** label or sequence of labels

    
**level** int/level name or list thereof, optional

    
**drop_level** bool, default True

    

If ` False  ` , the resulting index will not drop any level.

Returns  :

    

tuple

    

A 2-tuple where the elements :

Element 0: int, slice object or boolean array.

Element 1: The resulting sliced multiindex/index. If the key contains all
levels, this will be ` None  ` .

See also

[ ` MultiIndex.get_loc  `
](pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc
"pandas.MultiIndex.get_loc")

    

Get location for a label or a tuple of labels.

[ ` MultiIndex.get_locs  `
](pandas.MultiIndex.get_locs.html#pandas.MultiIndex.get_locs
"pandas.MultiIndex.get_locs")

    

Get location for a label/slice/list/mask or a sequence of such.

Examples

    
    
    >>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')],
    ...                                names=['A', 'B'])
    
    
    
    >>> mi.get_loc_level('b')
    (slice(1, 3, None), Index(['e', 'f'], dtype='object', name='B'))
    
    
    
    >>> mi.get_loc_level('e', level='B')
    (array([False,  True, False]), Index(['b'], dtype='object', name='A'))
    
    
    
    >>> mi.get_loc_level(['b', 'e'])
    (1, None)
    

[ __ previous  pandas.MultiIndex.get_locs  ](pandas.MultiIndex.get_locs.html
"previous page") [ next  pandas.MultiIndex.drop  __
](pandas.MultiIndex.drop.html "next page")

__ On this page

  * ` MultiIndex.get_loc_level()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.get_loc_level.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
by.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.empty  #

_ property  _ DataFrame.  empty  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L2082-L2140) #

    

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  ` ](pandas.Series.dropna.html#pandas.Series.dropna
"pandas.Series.dropna")

    

Return series without null values.

[ ` DataFrame.dropna  ` ](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna
"pandas.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
    

[ __ previous  pandas.DataFrame.memory_usage
](pandas.DataFrame.memory_usage.html "previous page") [ next
pandas.DataFrame.set_flags  __ ](pandas.DataFrame.set_flags.html "next page")

__ On this page

  * ` DataFrame.empty  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.empty.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
by.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.index  #

DataFrame.  index  #

    

The index (row labels) of the DataFrame.

The index of a DataFrame is a series of labels that identify each row. The
labels can be integers, strings, or any other hashable type. The index is used
for label-based access and alignment, and can be accessed or modified using
this attribute.

Returns  :

    

pandas.Index

    

The index labels of the DataFrame.

See also

[ ` DataFrame.columns  `
](pandas.DataFrame.columns.html#pandas.DataFrame.columns
"pandas.DataFrame.columns")

    

The column labels of the DataFrame.

[ ` DataFrame.to_numpy  `
](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy
"pandas.DataFrame.to_numpy")

    

Convert the DataFrame to a NumPy array.

Examples

    
    
    >>> df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'],
    ...                    'Age': [25, 30, 35],
    ...                    'Location': ['Seattle', 'New York', 'Kona']},
    ...                   index=([10, 20, 30]))
    >>> df.index
    Index([10, 20, 30], dtype='int64')
    

In this example, we create a DataFrame with 3 rows and 3 columns, including
Name, Age, and Location information. We set the index labels to be the
integers 10, 20, and 30. We then access the  index  attribute of the
DataFrame, which returns an  Index  object containing the index labels.

    
    
    >>> df.index = [100, 200, 300]
    >>> df
        Name  Age Location
    100  Alice   25  Seattle
    200    Bob   30 New York
    300  Aritra  35    Kona
    

In this example, we modify the index labels of the DataFrame by assigning a
new list of labels to the  index  attribute. The DataFrame is then updated
with the new labels, and the output shows the modified DataFrame.

[ __ previous  pandas.DataFrame  ](pandas.DataFrame.html "previous page") [
next  pandas.DataFrame.columns  __ ](pandas.DataFrame.columns.html "next
page")

__ On this page

  * ` DataFrame.index  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.index.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
pby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.last  #

DataFrame.  last  (  _ offset  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L9869-L9947) #

    

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

Deprecated since version 2.1:  ` last()  ` is deprecated and will be removed
in a future version. Please create a mask and filter using  .loc  instead.

For a DataFrame with a sorted DatetimeIndex, this function selects the last
few rows based on a date offset.

Parameters  :

    

**offset** str, DateOffset, dateutil.relativedelta

    

The offset length of the data that will be selected. For instance, â3Dâ
will display all the rows having their index within the last 3 days.

Returns  :

    

Series or DataFrame

    

A subset of the caller.

Raises  :

    

TypeError

    

If the index is not a [ ` DatetimeIndex  `
](pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex")

See also

[ ` first  ` ](pandas.DataFrame.first.html#pandas.DataFrame.first
"pandas.DataFrame.first")

    

Select initial periods of time series based on a date offset.

[ ` at_time  ` ](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time
"pandas.DataFrame.at_time")

    

Select values at a particular time of the day.

[ ` between_time  `
](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time
"pandas.DataFrame.between_time")

    

Select values between particular times of the day.

Notes

Deprecated since version 2.1.0:  Please create a mask and filter using  .loc
instead

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 last 3 days:

    
    
    >>> ts.last('3D')  
                A
    2018-04-13  3
    2018-04-15  4
    

Notice the data for 3 last calendar days were returned, not the last 3
observed days in the dataset, and therefore data for 2018-04-11 was not
returned.

[ __ previous  pandas.DataFrame.idxmin  ](pandas.DataFrame.idxmin.html
"previous page") [ next  pandas.DataFrame.reindex  __
](pandas.DataFrame.reindex.html "next page")

__ On this page

  * ` DataFrame.last()  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.last.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
rom_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.end_time  #

_ property  _ PeriodIndex.  end_time  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

Get the Timestamp for the end of the period.

Returns  :

    

Timestamp

    

See also

[ ` Period.start_time  `
](pandas.Period.start_time.html#pandas.Period.start_time
"pandas.Period.start_time")

    

Return the start Timestamp.

[ ` Period.dayofyear  ` ](pandas.Period.dayofyear.html#pandas.Period.dayofyear
"pandas.Period.dayofyear")

    

Return the day of year.

[ ` Period.daysinmonth  `
](pandas.Period.daysinmonth.html#pandas.Period.daysinmonth
"pandas.Period.daysinmonth")

    

Return the days in that month.

[ ` Period.dayofweek  ` ](pandas.Period.dayofweek.html#pandas.Period.dayofweek
"pandas.Period.dayofweek")

    

Return the day of the week.

Examples

For Period:

    
    
    >>> pd.Period('2020-01', 'D').end_time
    Timestamp('2020-01-01 23:59:59.999999999')
    

For Series:

    
    
    >>> period_index = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M')
    >>> s = pd.Series(period_index)
    >>> s
    0   2020-01
    1   2020-02
    2   2020-03
    dtype: period[M]
    >>> s.dt.end_time
    0   2020-01-31 23:59:59.999999999
    1   2020-02-29 23:59:59.999999999
    2   2020-03-31 23:59:59.999999999
    dtype: datetime64[ns]
    

For PeriodIndex:

    
    
    >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
    >>> idx.end_time
    DatetimeIndex(['2023-01-31 23:59:59.999999999',
                   '2023-02-28 23:59:59.999999999',
                   '2023-03-31 23:59:59.999999999'],
                   dtype='datetime64[ns]', freq=None)
    

[ __ previous  pandas.PeriodIndex.daysinmonth
](pandas.PeriodIndex.daysinmonth.html "previous page") [ next
pandas.PeriodIndex.freqstr  __ ](pandas.PeriodIndex.freqstr.html "next page")

__ On this page

  * ` PeriodIndex.end_time  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.end_time.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
by.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.style  #

_ property  _ DataFrame.  style  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L1422-L1444) #

    

Returns a Styler object.

Contains methods for building a styled HTML representation of the DataFrame.

See also

[ ` io.formats.style.Styler  `
](pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler
"pandas.io.formats.style.Styler")

    

Helps style a DataFrame or Series according to the data with HTML and CSS.

Examples

    
    
    >>> df = pd.DataFrame({'A': [1, 2, 3]})
    >>> df.style  
    

Please see [ Table Visualization  ](../../user_guide/style.html) for more
examples.

[ __ previous  pandas.DataFrame.to_markdown
](pandas.DataFrame.to_markdown.html "previous page") [ next
pandas.DataFrame.__dataframe__  __ ](pandas.DataFrame.__dataframe__.html "next
page")

__ On this page

  * ` DataFrame.style  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.style.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
tml)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.expanding  #

DataFrame.  expanding  (  _ min_periods  =  1  _ , _ axis  =
_NoDefault.no_default  _ , _ method  =  'single'  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L12593-L12622) #

    

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  ` .

**axis** int or str, default 0

    

If ` 0  ` or ` 'index'  ` , roll across the rows.

If ` 1  ` or ` 'columns'  ` , roll across the columns.

For  Series  this parameter is unused and defaults to 0.

**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  :

    

pandas.api.typing.Expanding

    

See also

[ ` rolling  ` ](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling
"pandas.DataFrame.rolling")

    

Provides rolling window calculations.

[ ` ewm  ` ](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm
"pandas.DataFrame.ewm")

    

Provides exponential weighted functions.

Notes

See [ Windowing Operations  ](../../user_guide/window.html#window-expanding)
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
    

[ __ previous  pandas.DataFrame.rolling  ](pandas.DataFrame.rolling.html
"previous page") [ next  pandas.DataFrame.ewm  __ ](pandas.DataFrame.ewm.html
"next page")

__ On this page

  * ` DataFrame.expanding()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.expanding.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.