summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorAntony Lee <anntzer.lee@gmail.com>2020-11-26 12:08:23 +0100
committerAntony Lee <anntzer.lee@gmail.com>2020-11-26 12:12:38 +0100
commit2eb0b12b75363f539870a09e155bf8e7a6ca8afa (patch)
tree2c4b9ab3d6b8c6c4f6a009b39c7c6a327ae09863 /numpy/core/fromnumeric.py
parent30cc38701d010d1cc053ddb9856b2d522c33c0f3 (diff)
downloadnumpy-2eb0b12b75363f539870a09e155bf8e7a6ca8afa.tar.gz
DOC: Clarify docs of np.resize().
- Iteration is done in C-order, not in memory storage order, and does not disregard strides during iteration (the implementation starts with calling `ravel()`). - This applies even when the new shape is larger, except that on top of that there's cycling in that case. The previous wording made it sound like "larger" was handled completely differently.
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index d65e26827..efb052bc2 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1375,7 +1375,7 @@ def resize(a, new_shape):
reshaped_array : ndarray
The new array is formed from the data in the old array, repeated
if necessary to fill out the required number of elements. The
- data are repeated in the order that they are stored in memory.
+ data are repeated iterating over the array in C-order.
See Also
--------
@@ -1392,11 +1392,11 @@ def resize(a, new_shape):
Warning: This functionality does **not** consider axes separately,
i.e. it does not apply interpolation/extrapolation.
- It fills the return array with the required number of elements, taken
- from `a` as they are laid out in memory, disregarding strides and axes.
- (This is in case the new shape is smaller. For larger, see above.)
- This functionality is therefore not suitable to resize images,
- or data where each axis represents a separate and distinct entity.
+ It fills the return array with the required number of elements, iterating
+ over `a` in C-order, disregarding axes (and cycling back from the start if
+ the new shape is larger). This functionality is therefore not suitable to
+ resize images, or data where each axis represents a separate and distinct
+ entity.
Examples
--------