Skip to content

Commit

Permalink
fix inaccurate data calculation with adata rolling and contribution (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
conglei authored and Grace Guo committed Mar 14, 2019
1 parent cc58f0e commit 0782e83
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,6 @@ def process_data(self, df, aggregate=False):
dfs.sort_values(ascending=False, inplace=True)
df = df[dfs.index]

if fd.get('contribution'):
dft = df.T
df = (dft / dft.sum()).T

rolling_type = fd.get('rolling_type')
rolling_periods = int(fd.get('rolling_periods') or 0)
min_periods = int(fd.get('min_periods') or 0)
Expand All @@ -1207,6 +1203,10 @@ def process_data(self, df, aggregate=False):
if min_periods:
df = df[min_periods:]

if fd.get('contribution'):
dft = df.T
df = (dft / dft.sum()).T

return df

def run_extra_queries(self):
Expand Down

0 comments on commit 0782e83

Please sign in to comment.