Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74d2d33

Browse files
committed
Simplify convert_to_string for numpy >= 1.7
1 parent 77dbccc commit 74d2d33

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

lib/matplotlib/category.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,7 @@ def __init__(self, seq):
6161

6262

6363
def convert_to_string(value):
64-
"""Helper function for numpy 1.6, can be replaced with
65-
np.array(...,dtype=unicode) for all later versions of numpy"""
66-
67-
if isinstance(value, six.string_types):
68-
pass
69-
elif np.isfinite(value):
70-
value = np.asarray(value, dtype=str)[np.newaxis][0]
71-
elif np.isnan(value):
72-
value = 'nan'
73-
elif np.isposinf(value):
74-
value = 'inf'
75-
elif np.isneginf(value):
76-
value = '-inf'
77-
else:
78-
raise ValueError("Unconvertable {}".format(value))
79-
return value
64+
return np.array(value, dtype=unicode)
8065

8166

8267
class UnitData(object):

0 commit comments

Comments
 (0)