From f9d89146a672f67f84e342a85c96438ee658f89d Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 18 Jan 2018 21:47:02 +0000 Subject: [PATCH] Fix 'argument to reversed() must be a sequence' 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 165d4a1e6428..6db51a1f5070 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)