Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Refactor NULL handling into method, disable for DECK.gl vizes (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored May 31, 2018
1 parent ff4b103 commit 2861110
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def run_extra_queries(self):
"""
pass

def handle_nulls(self, df):
fillna = self.get_fillna_for_columns(df.columns)
df = df.fillna(fillna)

def get_fillna_for_col(self, col):
"""Returns the value for use as filler for a specific Column.type"""
if col:
Expand Down Expand Up @@ -208,8 +212,7 @@ def get_df(self, query_obj=None):
self.df_metrics_to_num(df, query_obj.get('metrics') or [])

df.replace([np.inf, -np.inf], np.nan)
fillna = self.get_fillna_for_columns(df.columns)
df = df.fillna(fillna)
self.handle_nulls(df)
return df

@staticmethod
Expand Down Expand Up @@ -2041,6 +2044,9 @@ class BaseDeckGLViz(BaseViz):
credits = '<a href="https://uber.github.io/deck.gl/">deck.gl</a>'
spatial_control_keys = []

def handle_nulls(self, df):
pass

def get_metrics(self):
self.metric = self.form_data.get('size')
return [self.metric] if self.metric else []
Expand Down

0 comments on commit 2861110

Please sign in to comment.