Skip to content

Commit 073c585

Browse files
authored
[Fix] add_data() function failed in keplergl-jupyter (#2901)
1 parent 6e42597 commit 073c585

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

bindings/kepler.gl-jupyter/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "keplergl-jupyter",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "This is a simple jupyter widget for kepler.gl, an advanced geo-spatial visualization tool, to render large-scale interactive maps.",
55
"author": "Shan He",
66
"license": "MIT",

bindings/kepler.gl-jupyter/keplergl/_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: MIT
22
# Copyright contributors to the kepler.gl project
33

4-
version_info = (0, 3, 5, 'final', 0)
4+
version_info = (0, 3, 6, 'final', 0)
55

66
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
77

@@ -17,4 +17,4 @@
1717
#
1818
# The major version needs to match that of the JS package.
1919
# Note: this follows the semver format, which is used to match the JS package version in keplergl-plugin.js
20-
EXTENSION_SPEC_VERSION = '0.3.5'
20+
EXTENSION_SPEC_VERSION = '0.3.6'

bindings/kepler.gl-jupyter/keplergl/keplergl.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,26 +209,15 @@ def add_data(self, data, name="unnamed", use_arrow=False):
209209
''' Send data to Voyager
210210
211211
Inputs:
212-
- data string, can be a csv string or json string
212+
- data string, can be a dataframe, csv string or json string
213213
- name string
214214
215215
Example of use:
216216
keplergl.add_data(data_string, name="data_1")
217217
'''
218+
normalized = _normalize_data(data, use_arrow)
218219
copy = self.data.copy()
219-
220-
# assume data is a GeoJSON or CSV string, convert it to arrow if use_arrow is True
221-
if use_arrow:
222-
global g_use_arrow
223-
g_use_arrow = use_arrow
224-
try:
225-
gdf = geopandas.read_file(data, driver='GeoJSON')
226-
copy.update({name: gdf})
227-
except Exception:
228-
# if it fails, assume it is a csv string
229-
# load csv string to a dataframe
230-
df = pd.read_csv(data)
231-
copy.update({name: df})
220+
copy.update({name: normalized})
232221

233222
self.data = copy
234223

0 commit comments

Comments
 (0)