Just a suggestion - extend rolling
to support a rolling window with a step size, such as R's rollapply(by=X)
.
Pandas - inefficient solution (apply function to every window, then slice to get every second result)
import pandas ts = pandas.Series(range(0, 40, 2)) ts.rolling(5).apply(max).dropna()[::2]
Suggestion:
ts = pandas.Series(range(0, 40, 2)) ts.rolling(window=5, step=2).apply(max).dropna()
Inspired by R (see rollapply docs):
require(zoo) TS <- zoo(seq(0, 40, 2)) rollapply(TS, 5, FUN=max, by=2)
8 12 16 20 24 28 32 36 40
shizi626, sum2000, silvewheat, mrullmi, DBCerigo and 87 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4