summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorsolarjoe <walterwhite666@googlemail.com>2017-08-16 09:23:37 +0200
committerCharles Harris <charlesr.harris@gmail.com>2017-10-02 14:48:11 -0600
commitdb59c45e5d02877bb246838a7cb277e5e3eed48c (patch)
tree768cdbbc0fff88e74427557ed163b4a70e31f327 /numpy/add_newdocs.py
parent04c43f177dcf156ab85118898d30870a38df70cc (diff)
downloadnumpy-db59c45e5d02877bb246838a7cb277e5e3eed48c.tar.gz
DOC: Improve ndarray.shape property documentation.
[ci skip]
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 55538ad1b..f81f6cb72 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -2926,11 +2926,14 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('shape',
"""
Tuple of array dimensions.
+ As with `numpy.reshape`, one shape dimension can be -1. In this case, the value is
+ inferred from the length of the array and remaining dimensions.
Notes
-----
May be used to "reshape" the array, as long as this would not
require a change in the total number of elements
-
+ Using `numpy.reshape` or `ndarray.reshape` should always be preferred.
+ Setting the shape directly is not really a safe thing to do.
Examples
--------
>>> x = np.array([1, 2, 3, 4])
@@ -2948,6 +2951,10 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('shape',
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: total size of new array must be unchanged
+ See Also
+ --------
+ numpy.reshape : equivalent function
+ ndarray.reshape : equivalent function
"""))