From c443b8975a12841c00b1ba32d8dcf49bebd3797c Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 18 Jan 2018 15:22:22 -0800 Subject: [PATCH] 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. --- superset/viz.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset/viz.py b/superset/viz.py index 165d4a1e6428c..6db51a1f50706 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -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)