rolling-computation

non fixed rolling window

non fixed rolling window Question: I am looking to implement a rolling window on a list, but instead of a fixed length of window, I would like to provide a rolling window list: Something like this: l1 = [5, 3, 8, 2, 10, 12, 13, 15, 22, 28] l2 = [1, 2, 2, 2, 3, …

Total answers: 1

Pandas rolling apply using multiple columns

Pandas rolling apply using multiple columns Question: I am trying to use a pandas.DataFrame.rolling.apply() rolling function on multiple columns. Python version is 3.7, pandas is 1.0.2. import pandas as pd #function to calculate def masscenter(x): print(x); # for debug purposes return 0; #simple DF creation routine df = pd.DataFrame( [[’02:59:47.000282′, 87.60, 739], [’03:00:01.042391′, 87.51, 10], …

Total answers: 6

Error Msg: replace with Series.rolling(window=5).corr(other=<Series>)

Error Msg: replace with Series.rolling(window=5).corr(other=<Series>) Question: I am trying to find the rolling correlation of 5 periods between columns [‘High’] and [‘Low’]. I manage to calculate it but there is an error: FutureWarning: pd.rolling_corr is deprecated for Series and will be removed in a future version, replace with Series.rolling(window=5).corr(other=) Tried replacing it but it doesnt …

Total answers: 1

Pandas: rolling mean by time interval

Pandas: rolling mean by time interval Question: I’ve got a bunch of polling data; I want to compute a Pandas rolling mean to get an estimate for each day based on a three-day window. According to this question, the rolling_* functions compute the window based on a specified number of values, and not a specific …

Total answers: 9

How to calculate rolling / moving average using python + NumPy / SciPy?

How to calculate rolling / moving average using python + NumPy / SciPy? Question: There seems to be no function that simply calculates the moving average on numpy/scipy, leading to convoluted solutions. My question is two-fold: What’s the easiest way to (correctly) implement a moving average with numpy? Since this seems non-trivial and error prone, …

Total answers: 19

Python – rolling functions for GroupBy object

Python – rolling functions for GroupBy object Question: I have a time series object grouped of the type <pandas.core.groupby.SeriesGroupBy object at 0x03F1A9F0>. grouped.sum() gives the desired result but I cannot get rolling_sum to work with the groupby object. Is there any way to apply rolling functions to groupby objects? For example: x = range(0, 6) …

Total answers: 5