summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
author渡邉 美希 <miki.watanabe@watanabenoMacBook-Pro.local>2023-05-11 06:38:26 +0900
committerMiki Watanabe <paula.watanabe@mail.utoronto.ca>2023-05-11 16:23:20 -0400
commit2d1df665913a94aa1db6b7e9edbd5e846ebd1aea (patch)
treec54869f9bc2ec7472d0a69400a2718123d5ce6d9 /numpy
parentf45f692abac62265b760c0a249e8b417707c47d1 (diff)
downloadnumpy-2d1df665913a94aa1db6b7e9edbd5e846ebd1aea.tar.gz
DOC:clarify differences between ravel and reshape(-1)
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/fromnumeric.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 4608bc6de..69cabb33e 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1801,9 +1801,10 @@ def ravel(a, order='C'):
Returns
-------
y : array_like
- y is an array of the same subtype as `a`, with shape ``(a.size,)``.
- Note that matrices are special cased for backward compatibility, if `a`
- is a matrix, then y is a 1-D ndarray.
+ y is a contiguous 1-D array of the same subtype as `a`,
+ with shape ``(a.size,)``.
+ Note that matrices are special cased for backward compatibility,
+ if `a` is a matrix, then y is a 1-D ndarray.
See Also
--------
@@ -1822,7 +1823,8 @@ def ravel(a, order='C'):
column-major, Fortran-style index ordering.
When a view is desired in as many cases as possible, ``arr.reshape(-1)``
- may be preferable.
+ may be preferable. However, ``ravel`` supports ``K`` in the optional
+ ``order`` argument while ``reshape`` does not.
Examples
--------