diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2017-12-10 14:32:40 -0500 |
---|---|---|
committer | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2019-01-03 17:33:07 -0500 |
commit | 5afe650403bdb3aa1a3189c1b8c3233501208521 (patch) | |
tree | 224d819ab8a7d2e80a460648f1e8cb231bd4d237 /doc | |
parent | fd89a4137969b676d4449e2b61ecd7f4c5811d7a (diff) | |
download | numpy-5afe650403bdb3aa1a3189c1b8c3233501208521.tar.gz |
ENH: allow where in reduce operations.
In this implementation, if the ufunc does not have an identity, it needs
an initial vavlue to be supplied.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.17.0-notes.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/release/1.17.0-notes.rst b/doc/release/1.17.0-notes.rst index 5750ef016..c97f9a58e 100644 --- a/doc/release/1.17.0-notes.rst +++ b/doc/release/1.17.0-notes.rst @@ -35,6 +35,15 @@ C API changes New Features ============ +``np.ufunc.reduce`` and related functions now accept a ``where`` mask +--------------------------------------------------------------------- +``np.ufunc.reduce``, ``np.sum``, ``np.prod``, ``np.min``, ``np.max`` all +now accept a ``where`` keyword argument, which can be used to tell which +elements to include in the reduction. For reductions that do not have an +identity, it is necessary to also pass in an initial value (e.g., +``initial=np.inf`` for ``np.min``). For instance, the equivalent of +``nansum`` would be, ``np.sum(a, where=~np.isnan(a))``. + Improvements ============ |