Skip to content

Commit 0b23308

Browse files
authored
Merge pull request #758 from ocefpaf/fix_749
fixes #749
2 parents b3f31bb + c2eac0d commit 0b23308

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ API changes
1818

1919
Bug Fixes
2020

21+
- Fixed numpy array bug (#749) in _flatten
2122
- Unify `get_bounds` routine to avoid wrong responses
2223
- If Path option `fill_color` is present it will override `fill=False`
2324

folium/utilities.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
import struct
99
import zlib
1010

11+
import numpy as np
12+
1113
from six import binary_type, text_type
1214

13-
try:
14-
import numpy as np
15-
except ImportError:
16-
np = None
1715

1816
try:
1917
from urllib.parse import uses_relative, uses_netloc, uses_params, urlparse
@@ -60,7 +58,7 @@ def _locations_tolist(x):
6058

6159
def _flatten(container):
6260
for i in container:
63-
if isinstance(i, (list, tuple)):
61+
if isinstance(i, (list, tuple, np.ndarray)):
6462
for j in _flatten(i):
6563
yield j
6664
else:
@@ -167,10 +165,6 @@ def write_png(data, origin='upper', colormap=None):
167165
PNG formatted byte string
168166
169167
"""
170-
if np is None:
171-
raise ImportError('The NumPy package is required '
172-
' for this functionality')
173-
174168
if colormap is None:
175169
def colormap(x):
176170
return (x, x, x, 1)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
branca
22
jinja2
3+
numpy
34
requests
45
six

0 commit comments

Comments
 (0)