diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-02-22 13:23:39 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 13:23:39 -0600 |
commit | 02d508c90a214e0aeaf78b4ad41a578e267dce12 (patch) | |
tree | f6cb2d3341806fe0266b88d25d86b80fe0e78de0 /numpy/lib/function_base.py | |
parent | d23d968fef1464407bcb1b28147dcfff133bced4 (diff) | |
parent | aeae93b6c0042f6ed8f45205545985cc194f84f3 (diff) | |
download | numpy-02d508c90a214e0aeaf78b4ad41a578e267dce12.tar.gz |
Merge pull request #18110 from mhvk/function-base-piecewise-refactor
API: make piecewise subclass safe using use zeros_like.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index d33a0fa7d..c6db42ce4 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -8,7 +8,7 @@ import numpy as np import numpy.core.numeric as _nx from numpy.core import transpose from numpy.core.numeric import ( - ones, zeros, arange, concatenate, array, asarray, asanyarray, empty, + ones, zeros_like, arange, concatenate, array, asarray, asanyarray, empty, ndarray, around, floor, ceil, take, dot, where, intp, integer, isscalar, absolute ) @@ -606,7 +606,7 @@ def piecewise(x, condlist, funclist, *args, **kw): .format(n, n, n+1) ) - y = zeros(x.shape, x.dtype) + y = zeros_like(x) for cond, func in zip(condlist, funclist): if not isinstance(func, collections.abc.Callable): y[cond] = func |