From 1a46f25297acacf363847f98d7628c987742aa87 Mon Sep 17 00:00:00 2001 From: sangarshanan Date: Fri, 31 Jul 2020 06:52:03 +0530 Subject: [PATCH] [Jupyter] Convert to gdf to a dataframe instead of a copy (#1201) Signed-off-by: sangarshanan --- bindings/kepler.gl-jupyter/keplergl/keplergl.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bindings/kepler.gl-jupyter/keplergl/keplergl.py b/bindings/kepler.gl-jupyter/keplergl/keplergl.py index 12b3bfff07..fe1efa768b 100644 --- a/bindings/kepler.gl-jupyter/keplergl/keplergl.py +++ b/bindings/kepler.gl-jupyter/keplergl/keplergl.py @@ -34,11 +34,12 @@ def _gdf_to_dict(gdf): # will cause error if data frame has no geometry column name = gdf.geometry.name - copy = gdf.copy() - # convert it to wkt - copy[name] = copy.geometry.apply(lambda x: shapely.wkt.dumps(x)) + # convert geodataframe to dataframe + df = pd.DataFrame(gdf) + # convert geometry to wkt + df[name] = df.geometry.apply(lambda x: shapely.wkt.dumps(x)) - return _df_to_dict(copy) + return _df_to_dict(df) def _normalize_data(data): if isinstance(data, pd.DataFrame):