8000 Fix NumPy FutureWarning for non-tuple indexing. by QuLogic · Pull Request #11862 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix NumPy FutureWarning for non-tuple indexing. #11862

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 1 commit into from
Aug 17, 2018

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Aug 16, 2018

PR Summary

This fixes the warning:

.../matplotlib/mlab.py:395: FutureWarning: Using a non-tuple sequence
for multidimensional indexing is deprecated; use `arr[tuple(seq)]`
instead of `arr[seq]`. In the future this will be interpreted as an
array index, `arr[np.array(seq)]`, which will result either in an error
or a different result.

PR Checklist

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

@QuLogic QuLogic added this to the v3.0 milestone Aug 16, 2018
@@ -392,7 +392,7 @@ def detrend_mean(x, axis=None):

ind = [slice(None)] * x.ndim
ind[axis] = np.newaxis
return x - x.mean(axis)[ind]
return x - x.mean(axis)[tuple(ind)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Just replace the whole function with x - x.mean(axis, keepdims=True)?

This fixes the warning:
.../matplotlib/mlab.py:395: FutureWarning: Using a non-tuple sequence
for multidimensional indexing is deprecated; use `arr[tuple(seq)]`
instead of `arr[seq]`. In the future this will be interpreted as an
array index, `arr[np.array(seq)]`, which will result either in an error
or a different result.
@jklymak jklymak merged commit 9af32e6 into matplotlib:master Aug 17, 2018
@jklymak
Copy link
Member
jklymak commented Aug 17, 2018

The CI errors were just an install burp on CircleCI's part

@QuLogic QuLogic deleted the slice-tuple branch August 17, 2018 19:55
@tacaswell
Copy link
Member
tacaswell commented Aug 17, 2018

@meeseeksdev backport to v3.0.x

@lumberbot-app
Copy link
lumberbot-app bot commented Aug 17, 2018

Something went wrong ... Please have a look at my logs.

@Carreau
Copy link
Contributor
Carreau commented Aug 18, 2018

Mr Meeseeks saw the v3.0.X before you edited. You'll have to re-issue the command.

@jklymak
Copy link
Member
jklymak commented Aug 18, 2018

@meeseeksdev backport to v3.0.x

@jklymak
Copy link
Member
jklymak commented Aug 18, 2018

Thanks @Carreau ! BTW, Mr Meeseeks is great! I have no idea how it works, but it sure makes back porting easy. I particularly like the recent change where it tells us how to cherry-pick.

@Carreau
Copy link
Contributor
Carreau commented Aug 18, 2018

The code is ugly but available there with regular updates. In a nutshell, You can create a GitHub Application, and if a repo is enabled for this application github delivers all events on the repo to me. Then you "just" need to triage those and react accordingly.
For backports I simply close the repository, cherry-pick and use GitHub API to send a Pull-request.

I'm going to see if I can check that branch exists and post a useful message instead of just failling. If you have any improvement, send a pull-request and when merged, it will auto-deploy on heroku.

You can see minimal statistics here, but I want to make sure there is no sensitive data. The logs seem to be clean as well, but these I don't want to share, because those have private info.

tacaswell added a commit that referenced this pull request Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0