pyspark.pandas.window.Expanding.mean#
- Expanding.mean()[source]#
- Calculate the expanding mean of the values. - Note - the current implementation of this API uses Spark’s Window without specifying partition specification. This leads to move all data into single partition in single machine and could cause serious performance degradation. Avoid this method against very large dataset. - Returns
- Series or DataFrame
- Returned object type is determined by the caller of the expanding calculation. 
 
 - See also - pyspark.pandas.Series.expanding
- Calling object with Series data. 
- pyspark.pandas.DataFrame.expanding
- Calling object with DataFrames. 
- pyspark.pandas.Series.mean
- Equivalent method for Series. 
- pyspark.pandas.DataFrame.mean
- Equivalent method for DataFrame. 
 - Examples - The below examples will show expanding mean calculations with window sizes of two and three, respectively. - >>> s = ps.Series([1, 2, 3, 4]) >>> s.expanding(2).mean() 0 NaN 1 1.5 2 2.0 3 2.5 dtype: float64 - >>> s.expanding(3).mean() 0 NaN 1 NaN 2 2.0 3 2.5 dtype: float64