I'm using python 3.8.3 and pandas 1.1.5.
table_in.T
is a 18 by 209997 pandas dataframe. window
and periods
are both set to 12.
The following three lines of code respectively takes 9.52s, 6.27s and 5min53s to run.
rolledsum2_in = table_in.T.rolling(window, min_periods=periods).agg('sum')
rolledmean2_in = table_in.T.rolling(window, min_periods=periods).agg('mean')
rolledsumean_in = table_in.T.rolling(window, min_periods=periods).agg(['sum','mean'])
Why does it take so much longer when aggregating the rolling object by sum and mean together than doing them separately?