summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorGeoffrey Irving <irving@naml.us>2018-02-15 11:56:56 -0800
committerGeoffrey Irving <irving@naml.us>2018-02-21 08:44:21 -0800
commit579034a0c925ee9db5157141d73209beca037aeb (patch)
treee318e54057b9828b4c34905fe182a10b9841af5d /numpy
parent69fa37f422c845655492220440735e7c800306b8 (diff)
downloadpython-numpy-579034a0c925ee9db5157141d73209beca037aeb.tar.gz
python-numpy-579034a0c925ee9db5157141d73209beca037aeb.tar.bz2
python-numpy-579034a0c925ee9db5157141d73209beca037aeb.zip
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')
-rw-r--r--numpy/core/numeric.py8
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,