Skip to content

Commit

Permalink
Merge pull request #58 from mistercrunch/min_periods
Browse files Browse the repository at this point in the history
Setting min_periods to 1 for rolling windows
  • Loading branch information
mistercrunch committed Nov 8, 2015
2 parents a18cf2d + d75c5c8 commit 774ca9f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ class BigNumberViz(BaseViz):
'metric',
'compare_lag',
'compare_suffix',
#('rolling_type', 'rolling_periods'),
]

def reassignments(self):
Expand Down Expand Up @@ -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=''):
Expand Down

0 comments on commit 774ca9f

Please sign in to comment.