diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-01-02 16:51:42 -0500 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-01-02 16:51:42 -0500 |
commit | 7fbc43b98d59ef982671b456cebc229425ae7e4e (patch) | |
tree | 7f34064ec1facebc7ca341666ab9f0b53dd5e481 /numpy/core/fromnumeric.py | |
parent | d2b6e96f48df28fe346c6ac6fa35b2ac324ef2f6 (diff) | |
parent | 78f69df28acd80654705a43bcf1e977b9c423b53 (diff) | |
download | numpy-7fbc43b98d59ef982671b456cebc229425ae7e4e.tar.gz |
Merge pull request #5398 from Garrett-R/fix_5376
BUG: Fixes #5376: np.ravel to return same array type
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index c14d2e357..55789d780 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1342,6 +1342,10 @@ def ravel(a, order='C'): A 1-D array, containing the elements of the input, is returned. A copy is made only if needed. + As of NumPy 1.10, the returned array will have the same type as the input + array. (for example, a masked array will be returned for a masked array + input) + Parameters ---------- a : array_like @@ -1363,8 +1367,9 @@ def ravel(a, order='C'): Returns ------- - 1d_array : ndarray - Output of the same dtype as `a`, and of shape ``(a.size,)``. + y : array_like + Array of the same type as `a`, and of shape ``(a.size,)`` + or ``(1, a.size)`` for matrices. See Also -------- @@ -1422,7 +1427,7 @@ def ravel(a, order='C'): array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) """ - return asarray(a).ravel(order) + return asanyarray(a).ravel(order) def nonzero(a): |