Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG : np.sum silently drops keepdims for sub-classes of ndarray #4619

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 5 commits into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/release/1.11.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ FutureWarning to changed behavior
due to a bug, sometimes no warning was raised and the dimensions were
already preserved.


C API
~~~~~

Expand Down
25 changes: 24 additions & 1 deletion doc/release/1.12.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ XXX
the two coincide. Previous behavior of 'lower' + 0.5 is fixed.


``keepdims`` kwarg is passed through to user-class methods
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

numpy functions that take a ``keepdims`` kwarg now pass the value
through to the corresponding methods on ndarray sub-classes. Previously the
``keepdims`` keyword would be silently dropped. These functions now have
the following behavior:

1. If user does not provide ``keepdims``, no keyword is passed to the underlying
method.
2. Any user-provided value of ``keepdims`` is passed through as a keyword
argument to the method.

This will raise in the case where the method does not support a
``keepdims`` kwarg and the user explicitly passes in ``keepdims``.


The following functions are changed: ``sum``, ``product``,
``sometrue``, ``alltrue``, ``any``, ``all``, ``amax``, ``amin``,
``prod``, ``mean``, ``std``, ``var``, ``nanmin``, ``nanmax``,
``nansum``, ``nanprod``, ``nanmean``, ``nanmedian``, ``nanvar``,
``nanstd``


DeprecationWarning to error
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -73,4 +97,3 @@ Changes

Deprecations
============

Loading