Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

shims for categorical support for numpy < 1.8#8591

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dstansby merged 3 commits intomatplotlib:masterfromstory645:cattests
May 12, 2017

Conversation

story645
Copy link
Member

@story645story645 commentedMay 7, 2017
edited
Loading

Matplotlib doesn't render unicode strings with numpy below 1.7 and numpy below 1.8 is buggy with mixed type arrays, truncating strings to the size of the smallest string in the mixed type array. This PR introduces a shim that converts mixed type elements to strings before converting the input into an array, and it has a shim that decodes and encodes unicode, essentially forcing it into utf endpoint ASCII gibberish.

This PRcloses#7988

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant

@anntzer
Copy link
Contributor

We already require at least numpy 1.7. It may be better to just jump the minimum version to 1.8. For example, the oldest Ubuntu still not EOL'd is trusty LTS, which has 1.8.1 (https://wiki.ubuntu.com/Releases andhttp://packages.ubuntu.com/trusty/python/python-numpy).

@story645
Copy link
MemberAuthor

story645 commentedMay 8, 2017
edited
Loading

I'm fine with whichever. This supports down to 1.6 only because I couldn't reproduce the bug on 1.7. (And so don't know if the unicode issues appear with 1.7...)

Also dunno what codecov is mad about

@tacaswell
Copy link
Member

my guess is that by removing the decorator definition + applications you reduced the number of lines (and covered lines) in the tests files (which out changing the number of not-covered lines) so the fraction of covered lines went down slightly.

import collections


def shim_array(data):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

might be better to do this as

ifLooseVersion(np.__version__)<LooseVersion('1.8.0'):defshim_array(data):        ...else:defshim_array(data):returnnp.array(data,dtype=np.unicode)

so we only do the version check at import time.

Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Left one comment (to avoid frequently checking the numpy version, but do not think it is worth holding the PR)

@story645
Copy link
MemberAuthor

Updated based@tacaswell's comments. Can this be closed out?

@dstansbydstansby merged commit52413e0 intomatplotlib:masterMay 12, 2017
@dstansbydstansby added this to the2.1 (next point release) milestoneMay 12, 2017
@story645story645 deleted the cattests branchMay 12, 2017 19:13
@story645story645 restored the cattests branchAugust 7, 2017 04:04
@story645story645 deleted the cattests branchOctober 9, 2017 18:34
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

poor categorical support w/ numpy<1.8
4 participants
@story645@anntzer@tacaswell@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp