pandas 1.4.2

NotesParametersReturns
var(self, ddof: 'int' = 1, *args, engine: 'str | None' = None, engine_kwargs: 'dict[str, bool] | None' = None, **kwargs)

Notes

The default ddof of 1 used in Series.var is different than the default ddof of 0 in numpy.var .

A minimum of one period is required for the rolling calculation.

Parameters

ddof : int, default 1

Delta Degrees of Freedom. The divisor used in calculations is N - ddof , where N represents the number of elements.

*args :

For NumPy compatibility and will not have an effect on the result.

engine : str, default None
engine_kwargs : dict, default None
  • For 'cython' engine, there are no accepted engine_kwargs

  • For 'numba' engine, the engine can accept nopython , nogil and parallel dictionary keys. The values must either be True or False . The default engine_kwargs for the 'numba' engine is {'nopython': True, 'nogil': False, 'parallel': False}

    versionadded
**kwargs :

For NumPy compatibility and will not have an effect on the result.

Returns

Series or DataFrame

Return type is the same as the original object with np.float64 dtype.

Calculate the expanding variance.

See Also

numpy.var

Equivalent method for NumPy array.

pandas.DataFrame.expanding

Calling expanding with DataFrames.

pandas.DataFrame.var

Aggregating var for DataFrame.

pandas.Series.expanding

Calling expanding with Series data.

pandas.Series.var

Aggregating var for Series.

Examples

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])
This example is valid syntax, but we were not able to check execution
>>> s.expanding(3).var()
0         NaN
1         NaN
2    0.333333
3    0.916667
4    0.800000
5    0.700000
6    0.619048
dtype: float64
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/window/expanding.py#413
type: <class 'function'>
Commit: