import pandas as pd
0)
np.random.seed(= np.random.rand(100)
array = pd.Series(array) series
Expanding
Expanding window operations
expanding_mean
expanding_mean (input_array:numpy.ndarray)
np.testing.assert_allclose(expanding_mean(array), series.expanding().mean().values)
expanding_std
expanding_std (input_array:numpy.ndarray)
np.testing.assert_allclose(expanding_std(array), series.expanding().std().values)
expanding_max
expanding_max (x:numpy.ndarray)
max()) np.testing.assert_allclose(expanding_max(array), series.expanding().
expanding_min
expanding_min (x:numpy.ndarray)
min()) np.testing.assert_allclose(expanding_min(array), series.expanding().
Seasonal
= np.arange(array.size) % 7
seasons = series.groupby(seasons) grouped_series
seasonal_expanding_mean
seasonal_expanding_mean (x:numpy.ndarray, season_length:int)
np.testing.assert_allclose(7),
seasonal_expanding_mean(array, lambda y: y.expanding().mean())
grouped_series.transform( )
seasonal_expanding_std
seasonal_expanding_std (x:numpy.ndarray, season_length:int)
np.testing.assert_allclose(7),
seasonal_expanding_std(array, lambda y: y.expanding().std())
grouped_series.transform( )
seasonal_expanding_min
seasonal_expanding_min (x:numpy.ndarray, season_length:int)
np.testing.assert_allclose(7),
seasonal_expanding_min(array, lambda y: y.expanding().min())
grouped_series.transform( )
seasonal_expanding_max
seasonal_expanding_max (x:numpy.ndarray, season_length:int)
np.testing.assert_allclose(7),
seasonal_expanding_min(array, lambda y: y.expanding().min())
grouped_series.transform( )