Skip to content

Commit

Permalink
Fix 'argument to reversed() must be a sequence' (apache#4237)
Browse files Browse the repository at this point in the history
When passing empty/null location data out of certain rows in the spatial
control, Superset raises an error when trying to reverse the tuple.
  • Loading branch information
mistercrunch authored and michellethomas committed May 23, 2018
1 parent 1356943 commit c443b89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion superset/viz.py
Expand Up @@ -1852,7 +1852,10 @@ def process_spatial_data_obj(self, key, df):
elif spatial.get('type') == 'delimited':
df[key] = (df[spatial.get('lonlatCol')].str.split(spatial.get('delimiter')))
if spatial.get('reverseCheckbox'):
df[key] = [list(reversed(item))for item in df[key]]
df[key] = [
tuple(reversed(o)) if isinstance(o, (list, tuple)) else (0, 0)
for o in df[key]
]
del df[spatial.get('lonlatCol')]
elif spatial.get('type') == 'geohash':
latlong = df[spatial.get('geohashCol')].map(geohash.decode)
Expand Down

0 comments on commit c443b89

Please sign in to comment.