rolling-computation

BaseIndexer still broken with .count() and .min()?

混江龙づ霸主 提交于 2021-01-07 02:48:29
问题 I use a custom window function in pandas. This works fine for things like .mean() and .sum() . As I understand it other aggregations like .count() and .min() used to have problems but should be fixed. Currently .count() uses the internal roll_count function AFAICS. But I still don't get the expected results: import numpy as np import pandas as pd # Use largest most recent multiple of *modulo* past measurements: class ModuloIndexer(pd.api.indexers.BaseIndexer): def get_window_bounds(self, num

Rolling Z-score applied to pandas dataframe

半世苍凉 提交于 2021-01-04 09:20:12
问题 I would like to compute a rolling Z-score for one of my columns in my dataframe: import pandas as pd values = [1,2,3,4,5] d1= {'vol': values} df= pd.DataFrame(d1) Is there a way of doing this similar to this: df['mean'] = df.rolling(2).mean() Maybe with: from scipy import stats stats.zscore(df) EDIT : Found this approach in a similar post: def zscore_func(x): return (x[-1] - x[:-1].mean())/x[:-1].std(ddof=0) df.rolling(window=3).apply(zscore_func) 回答1: window = 2 target_column = 'vol' roll =

How to update to the developer version of statsmodels using Conda?

泪湿孤枕 提交于 2021-01-03 03:43:14
问题 I am currently trying to update my statsmodels package in Conda to the developer version statsmodels v0.11.0dev0. As I am relatively new to Python, I am struggling heavily to understand different threads on how to update to the developer version. On https://www.statsmodels.org/dev/install.html a short hint on how to install the developer version is given, nevertheless I cannot follow. I have tried the pip install -e and python setup.py develop. In order to specifically update the statsmodel

How to update to the developer version of statsmodels using Conda?

青春壹個敷衍的年華 提交于 2021-01-03 03:40:28
问题 I am currently trying to update my statsmodels package in Conda to the developer version statsmodels v0.11.0dev0. As I am relatively new to Python, I am struggling heavily to understand different threads on how to update to the developer version. On https://www.statsmodels.org/dev/install.html a short hint on how to install the developer version is given, nevertheless I cannot follow. I have tried the pip install -e and python setup.py develop. In order to specifically update the statsmodel