From d75c5c8da85ccbba03f1cd1627a78e553704e821 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sun, 8 Nov 2015 09:10:45 -0800 Subject: [PATCH] Setting min_periods to 1 for rolling windows --- panoramix/viz.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/panoramix/viz.py b/panoramix/viz.py index f21d2d7ad208a..80e575ef20385 100644 --- a/panoramix/viz.py +++ b/panoramix/viz.py @@ -372,7 +372,6 @@ class BigNumberViz(BaseViz): 'metric', 'compare_lag', 'compare_suffix', - #('rolling_type', 'rolling_periods'), ] def reassignments(self): @@ -455,11 +454,11 @@ def get_df(self, query_obj=None): rolling_type = form_data.get("rolling_type") if rolling_periods and rolling_type: if rolling_type == 'mean': - df = pd.rolling_mean(df, int(rolling_periods)) + df = pd.rolling_mean(df, int(rolling_periods), min_periods=1) elif rolling_type == 'std': - df = pd.rolling_std(df, int(rolling_periods)) + df = pd.rolling_std(df, int(rolling_periods), min_periods=1) elif rolling_type == 'sum': - df = pd.rolling_sum(df, int(rolling_periods)) + df = pd.rolling_sum(df, int(rolling_periods), min_periods=1) return df def to_series(self, df, classed='', title_suffix=''):