Fix 'argument to reversed() must be a sequence' (#4237)

When passing empty/null location data out of certain rows in the spatial
control, Superset raises an error when trying to reverse the tuple.
This commit is contained in:
Maxime Beauchemin 2018-01-18 15:22:22 -08:00 committed by GitHub
parent 5079b2aa95
commit 36caca3244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1852,7 +1852,10 @@ class BaseDeckGLViz(BaseViz):
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)