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

FIX: let pandas IndexInt64 work for boxplot#13398

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
NelleV merged 3 commits intomatplotlib:masterfromjklymak:fix-boxplot-pandas
Feb 19, 2019

Conversation

@jklymak
Copy link
Member

PR Summary

Closes#10022 by casting the list of positions to an array as suggested by@tacaswell

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak
Copy link
MemberAuthor

I think this fix is "OK" as a stopgap, but I think what really should happen isposition be put through unit conversion (which I don't think it is). But I'll leave that for someone who actually uses boxplot to make sure it is done properly... Still think this should go in to make array-like things w/o units work OK. Happy to be told that someone's favourite units used to work, but break w/ this change.

positions=list(range(1,N+1))
eliflen(positions)!=N:
raiseValueError(datashape_message.format("positions"))
positions=np.array(positions)
Copy link
Member

Choose a reason for hiding this comment

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

This is a good fix for the case described in the ticket, but I think the code will continue raising obscure error when positions are not numbers. Can you add a check after this line about the dtype of the array being a number? Maybe something like:

ifnotisinstance(positions.dtype,numbers.Number):raiseTypeError("positions should be a iterable of dtype number, but found dtype %s"%blahblahblah.)

When we end up supporting something else than numbers, this can be updated.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I couldn't quite get that check to work; I had to check the first element. But if there is a better way, let me know.

@NelleVNelleV merged commit2884058 intomatplotlib:masterFeb 19, 2019
@NelleV
Copy link
Member

Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NelleVNelleVNelleV left review comments

@dstansbydstansbydstansby approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

v3.1.0

Development

Successfully merging this pull request may close these issues.

boxplot: positions used to take Int64Index

4 participants

@jklymak@NelleV@dstansby@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp