summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2023-05-12 07:25:55 +0300
committerGitHub <noreply@github.com>2023-05-12 07:25:55 +0300
commitfa64a30290f9996bec03dd8a0bc4a09148ae05f3 (patch)
treec54869f9bc2ec7472d0a69400a2718123d5ce6d9
parentf45f692abac62265b760c0a249e8b417707c47d1 (diff)
parent2d1df665913a94aa1db6b7e9edbd5e846ebd1aea (diff)
downloadnumpy-fa64a30290f9996bec03dd8a0bc4a09148ae05f3.tar.gz
Merge pull request #23747 from MikiPWata/DOC/clarify_ravel_vs_reshape
DOC: clarify differences between ravel and reshape(-1)
-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
--------