pandas.core.window.expanding.Expanding.first#
- Expanding.first(numeric_only=False)[source]#
Calculate the expanding First (left-most) element of the window.
- Parameters:
- numeric_onlybool, default False
Include only float, int, boolean columns.
Added in version 1.5.0.
- Returns:
- Series or DataFrame
Return type is the same as the original object with
np.float64
dtype.
See also
GroupBy.first
Similar method for GroupBy objects.
Expanding.last
Method to get the last element in each window.
Examples
The example below will show an expanding calculation with a window size of three.
>>> s = pd.Series(range(5)) >>> s.expanding(3).first() 0 NaN 1 NaN 2 0.0 3 0.0 4 0.0 dtype: float64