8000 Simplify convert_to_string for numpy >= 1.7 · matplotlib/matplotlib@74d2d33 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74d2d33

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

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

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)
0