Skip to content

Remove some numpy 1.6 workarounds #7494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 24, 2016
Prev Previous commit
Next Next commit
Remove old to_array method
  • Loading branch information
dstansby committed Nov 21, 2016
commit 77dbcccf2a35ec4003ad29e0f25def8947b2fe72
8 changes: 2 additions & 6 deletions lib/matplotlib/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
import matplotlib.ticker as ticker


def to_array(data, maxlen=100):
return np.array(data, dtype=np.unicode)


class StrCategoryConverter(units.ConversionInterface):
@staticmethod
def convert(value, unit, axis):
Expand All @@ -29,7 +25,7 @@ def convert(value, unit, axis):
if isinstance(value, six.string_types):
return vmap[value]

vals = to_array(value)
vals = np.array(value, dtype=np.unicode)
for lab, loc in vmap.items():
vals[vals == lab] = loc

Expand Down Expand Up @@ -105,7 +101,7 @@ def update(self, new_data):

def _set_seq_locs(self, data, value):
# magic to make it work under np1.6
strdata = to_array(data)
strdata = np.array(data, dtype=np.unicode)
# np.unique makes dateframes work
new_s = [d for d in np.unique(strdata) if d not in self.seq]
for ns in new_s:
Expand Down