8000 poor categorical support w/ numpy<1.8 · Issue #7988 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

poor categorical support w/ numpy<1.8 #7988

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

Closed
story645 opened this issue Jan 30, 2017 · 3 comments · Fixed by #8591
Closed

poor categorical support w/ numpy<1.8 #7988

story645 opened this issue Jan 30, 2017 · 3 comments · Fixed by #8591

Comments

@story645
Copy link
Member

Numpy versions < 1.8 play poorly with arrays of mixed type, truncating anything not of type string to the length of the longest string. This is inhibiting #7974

So the issue is as follows

>>> import numpy as np
>>> np.__version__
'1.7.1'
>>> np.array(['A', 'A', np.nan, 'B', -np.inf, 3.14], dtype=np.unicode)
array([u'A', u'A', u'n', u'B', u'-', u'3'], 
      dtype='<U1')

two possible solutions:

  1. Fold back in shims removed in Remove numpy 1.6 specific work-arounds  #7484 that existed mainly to solve this problem
  2. throw a warning if category.py is imported with a numpy<1.8 and skip tests for numpy<1.8

The advantage of 2 is it keeps the code cleaner and this is an edge case of sorts because it's only an issue when the array is of mixed type (strings and numbers). The advantage of 1 is of course edge case support on older systems.

@efiring
Copy link
Member
efiring commented Jan 30, 2017

I think option 1 is preferable--less likely to trigger questions from users, and simpler in that it is localized to a single module. Comments could be added to make it very simple to strip out the shims when we no longer support numpy 1.7.

@QuLogic
Copy link
Member
QuLogic commented Jan 31, 2017

I think what we can do is add a skip to #7974 so that testing starts working as it should be, and then @story645 can open a PR restoring the shims which will properly be tested once testing works.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jan 31, 2017
@tacaswell
Copy link
Member

👍 to @QuLogic 's plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0