Skip to content

MAINT: FutureWarning for changes to np.average subclass handling#7433

Merged
charris merged 1 commit intonumpy:masterfrom
ahaldane:deprecate_average
Jun 14, 2016
Merged

MAINT: FutureWarning for changes to np.average subclass handling#7433
charris merged 1 commit intonumpy:masterfrom
ahaldane:deprecate_average

Conversation

@ahaldane
Copy link
Copy Markdown
Member

This slightly rolls back the changes to np.average in #7382, so that we emit a FutureWarning if np.average is called on an ndarray subclass. In the future, np.average will preserve subclasses, just like np.mean and almost all other numpy methods.

This is to fix #7403. Note that the specific case in #7403 will probably also be fixed by #7406, but this PR should make sure we aren't more generally breaking anyone's code (for now).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If doing this, should add comment with data and release to help track when to change. Something like

# 3/19/2016 1.12.0

@charris
Copy link
Copy Markdown
Member

charris commented Mar 19, 2016

Also add something to the release notes. The 1.11.0 notes have a FutureWarnings section and having that for the 1.12.0 notes would make sense. Also a summary entry in future changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since I hope to change this everywhere else as well by 1.12 (and probably force it in the numpy code base for the most part), could you add a stacklevel=2?

@ahaldane ahaldane force-pushed the deprecate_average branch from 0105073 to 6b0301e Compare March 19, 2016 23:18
@ahaldane
Copy link
Copy Markdown
Member Author

Updated

@homu
Copy link
Copy Markdown
Contributor

homu commented Mar 20, 2016

☔ The latest upstream changes (presumably #7437) made this pull request unmergeable. Please resolve the merge conflicts.

@lesteve
Copy link
Copy Markdown
Contributor

lesteve commented Apr 4, 2016

I am not sure what is the status of this now that #7406 has been merged.

It if is still needed it needs a rebase on master and there is a behaior -> behavior typo to fix (missing v). EDIT: in two places.

@charris charris added this to the 1.12.0 release milestone Apr 16, 2016
@charris
Copy link
Copy Markdown
Member

charris commented Jun 13, 2016

@ahaldane What is the status of this? Note also the previous comment. Looks straight forward to me.

@ahaldane
Copy link
Copy Markdown
Member Author

Yeah, looks like we should do this. I'll fix it up tonight probably.

@ahaldane ahaldane force-pushed the deprecate_average branch from 6b0301e to 5917372 Compare June 14, 2016 04:47
@charris charris merged commit ce08966 into numpy:master Jun 14, 2016
@charris
Copy link
Copy Markdown
Member

charris commented Jun 14, 2016

Thanks Allan.

@mhvk
Copy link
Copy Markdown
Contributor

mhvk commented Oct 21, 2016

Just a reminder that for 1.12.0 the behaviour was supposed to be changed to allow subclasses in np.average (I think). it would help for Quantity (see astropy/astropy#5421)

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.

np.average of memmap returns memmap 0d array instead of numpy scalar

6 participants