diff options
| author | Geoffrey Irving <irving@naml.us> | 2018-02-15 11:56:56 -0800 |
|---|---|---|
| committer | Geoffrey Irving <irving@naml.us> | 2018-02-21 08:44:21 -0800 |
| commit | 579034a0c925ee9db5157141d73209beca037aeb (patch) | |
| tree | e318e54057b9828b4c34905fe182a10b9841af5d /numpy/core | |
| parent | 69fa37f422c845655492220440735e7c800306b8 (diff) | |
| download | numpy-579034a0c925ee9db5157141d73209beca037aeb.tar.gz | |
ENH: make flatnonzero use np.ravel(a) instead of a.ravel()
It now works for lists and other numpy-convertible input.
Fixes #10598.
Diffstat (limited to 'numpy/core')
| -rw-r--r-- | numpy/core/numeric.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 123bff2ec..5c8951474 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -829,12 +829,12 @@ def flatnonzero(a): """ Return indices that are non-zero in the flattened version of a. - This is equivalent to a.ravel().nonzero()[0]. + This is equivalent to np.nonzero(np.ravel(a))[0]. Parameters ---------- - a : ndarray - Input array. + a : array_like + Input data. Returns ------- @@ -862,7 +862,7 @@ def flatnonzero(a): array([-2, -1, 1, 2]) """ - return a.ravel().nonzero()[0] + return np.nonzero(np.ravel(a))[0] _mode_from_name_dict = {'v': 0, |
