Skip to content

Commit a816422

Browse files
author
Martin Journois
committed
accept numpy.array in HeatMap
1 parent 18c0069 commit a816422

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

folium/plugins/heat_map.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def __init__(self, data, name=None,
2020
2121
Parameters
2222
----------
23-
data : list of points of the form [lat, lng, weight]
24-
The point you want to plot.
23+
data : list of points of the form [lat, lng] or [lat, lng, weight]
24+
The points you want to plot.
25+
You can alos provide a numpy.array of shape (n,2) or (n,3).
2526
name : str
2627
The name of the layer that will be created.
2728
min_opacity : default 1.
@@ -42,7 +43,7 @@ def __init__(self, data, name=None,
4243
self._name = 'HeatMap'
4344
self.tile_name = name if name is not None else self.get_name()
4445

45-
self.data= data
46+
self.data = [[x for x in line] for line in data]
4647
self.min_opacity = min_opacity
4748
self.max_zoom = max_zoom
4849
self.max_val = max_val

0 commit comments

Comments
 (0)