mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Introduce class attr BaseViz.enforce_numerical_metrics (#5176)
This commit is contained in:
parent
30111bf3fd
commit
a1095437bc
@ -59,6 +59,7 @@ class BaseViz(object):
|
|||||||
is_timeseries = False
|
is_timeseries = False
|
||||||
default_fillna = 0
|
default_fillna = 0
|
||||||
cache_type = 'df'
|
cache_type = 'df'
|
||||||
|
enforce_numerical_metrics = True
|
||||||
|
|
||||||
def __init__(self, datasource, form_data, force=False):
|
def __init__(self, datasource, form_data, force=False):
|
||||||
if not datasource:
|
if not datasource:
|
||||||
@ -209,7 +210,8 @@ class BaseViz(object):
|
|||||||
df[DTTM_ALIAS] += timedelta(hours=self.datasource.offset)
|
df[DTTM_ALIAS] += timedelta(hours=self.datasource.offset)
|
||||||
df[DTTM_ALIAS] += self.time_shift
|
df[DTTM_ALIAS] += self.time_shift
|
||||||
|
|
||||||
self.df_metrics_to_num(df, query_obj.get('metrics') or [])
|
if self.enforce_numerical_metrics:
|
||||||
|
self.df_metrics_to_num(df, query_obj.get('metrics') or [])
|
||||||
|
|
||||||
df.replace([np.inf, -np.inf], np.nan)
|
df.replace([np.inf, -np.inf], np.nan)
|
||||||
self.handle_nulls(df)
|
self.handle_nulls(df)
|
||||||
@ -483,6 +485,7 @@ class TableViz(BaseViz):
|
|||||||
verbose_name = _('Table View')
|
verbose_name = _('Table View')
|
||||||
credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
|
credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
|
||||||
is_timeseries = False
|
is_timeseries = False
|
||||||
|
enforce_numerical_metrics = False
|
||||||
|
|
||||||
def should_be_timeseries(self):
|
def should_be_timeseries(self):
|
||||||
fd = self.form_data
|
fd = self.form_data
|
||||||
|
Loading…
Reference in New Issue
Block a user