[bugfix] add support for numeric nodes in Sankey (#5154)

* [bugfix] add support for numeric nodes in Sankey

closes https://github.com/apache/incubator-superset/issues/5142

* lint
This commit is contained in:
Maxime Beauchemin 2018-06-21 18:09:08 -07:00 committed by GitHub
parent 5a716e9925
commit b344056932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,7 @@ from markdown import markdown
import numpy as np
import pandas as pd
from pandas.tseries.frequencies import to_offset
from past.builtins import basestring
import polyline
import simplejson as json
from six import string_types, text_type
@ -1596,6 +1597,8 @@ class SankeyViz(BaseViz):
def get_data(self, df):
df.columns = ['source', 'target', 'value']
df['source'] = df['source'].astype(basestring)
df['target'] = df['target'].astype(basestring)
recs = df.to_dict(orient='records')
hierarchy = defaultdict(set)