Skip to content

Commit

Permalink
[Jupyter] Convert to gdf to a dataframe instead of a copy (keplergl#1201
Browse files Browse the repository at this point in the history
)

Signed-off-by: sangarshanan <[email protected]>
  • Loading branch information
Sangarshanan authored Jul 31, 2020
1 parent 7eace48 commit 1a46f25
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bindings/kepler.gl-jupyter/keplergl/keplergl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1a46f25

Please sign in to comment.