When you use b = a.reshape((5,4,5)) you just create a different view on the same data used by the array a. (ie changes to the elements of a will appear in b). reshape() does not copy data in this case, so it is a very fast operation. Slicing b and slicing a accesses the same memory, so there shouldn't be any need for a different syntax for the b array (just use a[:10]). If you have created a copy of the data, perhaps with np.resize(), and discarded a, just reshape b: b.reshape((20,5))[:10].

Answer from xnx on Stack Overflow
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.reshape.html
numpy.reshape โ€” NumPy v2.4 Manual
You can think of reshaping as first raveling the array (using the given index order), then inserting the elements from the raveled array into the new array using the same kind of index ordering as was used for the raveling. >>> np.reshape(a, (2, 3)) # C-like index ordering array([[0, 1, 2], ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ numpy โ€บ numpy_array_reshape.asp
NumPy Array Reshaping
By reshaping we can add or remove dimensions or change number of elements in each dimension. Convert the following 1-D array with 12 elements into a 2-D array. The outermost dimension will have 4 arrays, each with 3 elements: import numpy as ...
๐ŸŒ
w3resource
w3resource.com โ€บ numpy โ€บ manipulation โ€บ reshape.php
NumPy: numpy.reshape() function - w3resource
March 24, 2023 - Then, the np.reshape() function is used to reshape the array x into a 3x2 array. The first argument of the np.reshape() function is the array to be reshaped, and the second argument is the desired shape of the new array.
๐ŸŒ
Flexiple
flexiple.com โ€บ python โ€บ numpy-reshape
Numpy reshape() - function for reshaping arrays - Flexiple
March 15, 2022 - Learn how to use the Numpy reshape() function to efficiently rearrange the dimensions of arrays for various data manipulation tasks.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ numpy-reshape-python
numpy.reshape() in Python - GeeksforGeeks
January 13, 2025 - Array which is reshaped without changing the data. It allows to automatically calculate the dimension that is unspecified as long as the total size of the array remains consistent.
๐ŸŒ
Sparrow Computing
sparrow.dev โ€บ home โ€บ blog โ€บ reshaping arrays: how the numpy reshape operation works
Reshaping Arrays: How the NumPy Reshape Operation Works - Sparrow Computing
October 21, 2021 - The NumPy reshape operation changes the shape of an array so that it has a new (but compatible) shape. The rules are: The number of elements stays the same. The order of the elements stays the same[1]. Hereโ€™s a simple example that takes a ...
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @jennycoreholt โ€บ numpy-reshape-explained-turning-data-into-the-shape-you-need-5406b93653fc
NumPy reshape() Explained: Turning Data Into the Shape You Need | by Jenny Core-Holt | Medium
June 29, 2025 - NumPy reshape() Explained: Turning Data Into the Shape You Need What is np.reshape()? np.reshape() is a method in NumPy that changes the shape (or structure) of an array without changing the data โ€ฆ
๐ŸŒ
Real Python
realpython.com โ€บ numpy-reshape
Using NumPy reshape() to Change the Shape of an Array โ€“ Real Python
July 21, 2023 - In this tutorial, you'll learn how to use NumPy reshape() to rearrange the data in an array. You'll learn to increase and decrease the number of dimensions and to configure the data in the new array to suit your requirements.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python โ€บ numpy
NumPy: reshape() to change the shape of an array | note.nkmk.me
February 1, 2024 - In NumPy, to change the shape of an array (ndarray), use the reshape() method of ndarray or the np.reshape() function. numpy.ndarray.reshape โ€” NumPy v1.26 Manual numpy.reshape โ€” NumPy v1.26 Manual H ...
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ numpy โ€บ reshape
NumPy reshape()
The NumPy `reshape()` function is an array operation that changes the shape of an array without altering its data.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ numpy โ€บ numpy_reshape.htm
Numpy reshape() Function
The Numpy reshape() Function is used to change the shape of an array without altering its data. It returns a new view or array with the specified dimensions, provided the total number of elements remains constant.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ numpy-reshape-function-86496
NumPy Reshape: Python Array Transformation with np.reshape() | LabEx
The reshape() function in the NumPy library allows you to change the shape of an array without altering its data. This powerful function helps you reorganize array elements into different dimensions based on your specific needs.
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ np.reshape in python
np.reshape in python | Towards Data Science
January 15, 2025 - Because of this, many times I worked around np.reshape, but today I will face my destiny. In NumPy, an array has a specific shape. When we create an array with np.array, numpy automatically infers the shape. Letโ€™s create a one-dimensional array. ... Donโ€™t be distracted by the comma in the shape tuple, it is only there so that we can identify it as a tuple.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.3 โ€บ reference โ€บ generated โ€บ numpy.reshape.html
numpy.reshape โ€” NumPy v2.3 Manual
You can think of reshaping as first raveling the array (using the given index order), then inserting the elements from the raveled array into the new array using the same kind of index ordering as was used for the raveling. >>> np.reshape(a, (2, 3)) # C-like index ordering array([[0, 1, 2], ...
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.reshape.html
numpy.reshape โ€” NumPy v2.5.dev0 Manual
You can think of reshaping as first raveling the array (using the given index order), then inserting the elements from the raveled array into the new array using the same kind of index ordering as was used for the raveling. >>> np.reshape(a, (2, 3)) # C-like index ordering array([[0, 1, 2], ...
๐ŸŒ
CodingNomads
codingnomads.com โ€บ np-reshape-np-flatten-np-ravel
NumPy Array Manipulation: np.reshape, np.flatten, np.ravel, np.newaxis, np.squeeze
To do that, we use .reshape() ... NumPy Reshape will take the elements of the 1D array and place them into the new specified shape. It will fill the array based on the order of the elements in the original array.
๐ŸŒ
Machine Learning Plus
machinelearningplus.com โ€บ python โ€บ numpy-reshape
Numpy Reshape - How to reshape arrays and what does -1 mean? - Machine Learning Plus
March 8, 2022 - The -1 informs numpy to automatically infer the dimension of that axis. So, on applying np.reshape() function for shape (2,-1), Numpy is able to infer the last dimension as 4 automatically. But what happens if you donโ€™t even put the 1 in the dimension of the output array and simply use just -1 instead?