pandas.api.typing.Expanding.count#
- Expanding.count(numeric_only=False)[source]#
Calculate the expanding count of non NaN observations.
At each point in time, returns the number of non-NaN values seen so far. This is useful for tracking data availability across an expanding window.
- Parameters:
- numeric_onlybool, default False
Include only float, int, boolean columns.
- Returns:
- Series or DataFrame
Return type is the same as the original object with
np.float64dtype.
See also
Series.expandingCalling expanding with Series data.
DataFrame.expandingCalling expanding with DataFrames.
Series.countAggregating count for Series.
DataFrame.countAggregating count for DataFrame.
Examples
>>> ser = pd.Series([1, 2, 3, 4], index=["a", "b", "c", "d"]) >>> ser.expanding().count() a 1.0 b 2.0 c 3.0 d 4.0 dtype: float64