reshape
Gives a new shape to an array without changing its data.Array to be reshaped.
The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Read the elements of
a using this index order, and place the elements into the reshaped array using this index order.'C'- Read/write in C-like (row-major) order, with the last axis index changing fastest'F'- Read/write in Fortran-like (column-major) order, with the first index changing fastest'A'- Read/write in Fortran-like order ifais Fortran contiguous in memory, C-like order otherwise
If
True, then the array data is copied. If None, a copy will only be made if required by order. For False it raises a ValueError if a copy cannot be avoided.ndarray - The reshaped array. This will be a new view object if possible; otherwise, it will be a copy.
Examples
See Also
ndarray.reshape- Equivalent methodravel- Return a flattened array
ravel
Return a contiguous flattened array.Input array. The elements in
a are read in the order specified by order, and packed as a 1-D array.The elements of
a are read using this index order.'C'- Index in row-major, C-style order'F'- Index in column-major, Fortran-style order'A'- Read in Fortran-like order ifais Fortran contiguous in memory, C-like order otherwise'K'- Read in the order the elements occur in memory, except for reversing the data when strides are negative
ndarray - A contiguous 1-D array of the same subtype as a, with shape (a.size,). A copy is made only if needed.
Examples
See Also
ndarray.flat- 1-D iterator over an arrayndarray.flatten- 1-D array copy in row-major orderreshape- Change the shape without changing data
ndarray.flat
A 1-D iterator over the array.Examples
See Also
ravel- Return a flattened arrayndarray.flatten- Return a copy of the array collapsed into one dimension
ndarray.flatten
Return a copy of the array collapsed into one dimension.The order to read the elements of the array.
'C'- Flatten in row-major (C-style) order'F'- Flatten in column-major (Fortran-style) order'A'- Flatten in column-major order ifais Fortran contiguous, row-major otherwise'K'- Flatten in the order the elements occur in memory
ndarray - A copy of the input array, flattened to one dimension.
Examples
See Also
ravel- Return a flattened array (may return a view)ndarray.flat- A 1-D flat iterator over the array
