superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [incubator-superset] branch master updated: [bugfix] 'No numeric types to aggregate' in NVD3 chart (#5853)
Date Tue, 11 Sep 2018 06:01:37 GMT
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 73cfccc  [bugfix] 'No numeric types to aggregate' in NVD3 chart (#5853)
73cfccc is described below

commit 73cfcccf050d71f13edc88b330ef6433ebad7ff4
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Mon Sep 10 23:01:34 2018 -0700

    [bugfix] 'No numeric types to aggregate' in NVD3 chart (#5853)
---
 superset/viz.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index da4f32c..6e2fc54 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -225,15 +225,15 @@ class BaseViz(object):
                 df[DTTM_ALIAS] += self.time_shift
 
             if self.enforce_numerical_metrics:
-                self.df_metrics_to_num(df, query_obj.get('metrics') or [])
+                self.df_metrics_to_num(df)
 
             df.replace([np.inf, -np.inf], np.nan)
             df = self.handle_nulls(df)
         return df
 
-    @staticmethod
-    def df_metrics_to_num(df, metrics):
+    def df_metrics_to_num(self, df):
         """Converting metrics to numeric when pandas.read_sql cannot"""
+        metrics = self.metric_labels
         for col, dtype in df.dtypes.items():
             if dtype.type == np.object_ and col in metrics:
                 df[col] = pd.to_numeric(df[col], errors='coerce')


Mime
View raw message