From 6fee0587eeac2ed1d288455cf8d773d9e3193127 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Thu, 5 Jul 2018 00:04:57 +0200 Subject: [PATCH] Implement rolling api introduced in pandas 0.18 (#5328) * Implement new rolling api introduced in pandas 0.18 * Bump pandas to 0.23.1 * Add 0.18 requirement in setup.py * Require >=0.18.0, not just 0.18 --- requirements.txt | 2 +- setup.py | 2 +- superset/viz.py | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index aaf97d1b7bcf2..a347a9f338711 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ gunicorn==19.8.0 humanize==0.5.1 idna==2.6 markdown==2.6.11 -pandas==0.22.0 +pandas==0.23.1 parsedatetime==2.0.0 pathlib2==2.3.0 polyline==1.3.2 diff --git a/setup.py b/setup.py index 0e7243f35eac6..bb216886a9534 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ def get_git_sha(): 'humanize', 'idna', 'markdown', - 'pandas', + 'pandas>=0.18.0', 'parsedatetime', 'pathlib2', 'polyline', diff --git a/superset/viz.py b/superset/viz.py index 6b3c6d8435ca2..ee423b4d81669 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -1175,15 +1175,14 @@ def process_data(self, df, aggregate=False): if rolling_type in ('mean', 'std', 'sum') and rolling_periods: kwargs = dict( - arg=df, window=rolling_periods, min_periods=min_periods) if rolling_type == 'mean': - df = pd.rolling_mean(**kwargs) + df = df.rolling(**kwargs).mean() elif rolling_type == 'std': - df = pd.rolling_std(**kwargs) + df = df.rolling(**kwargs).std() elif rolling_type == 'sum': - df = pd.rolling_sum(**kwargs) + df = df.rolling(**kwargs).sum() elif rolling_type == 'cumsum': df = df.cumsum() if min_periods: