🌐
W3Schools
w3schools.com › python › numpy › numpy_array_shape.asp
NumPy Array Shape
NumPy arrays have an attribute called shape that returns a tuple with each index having the number of corresponding elements.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.5.dev0 Manual
The elements of the shape tuple give the lengths of the corresponding array dimensions. ... Equivalent array method. ... Try it in your browser! >>> import numpy as np >>> np.shape(np.eye(3)) (3, 3) >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) ()
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.3 Manual
The elements of the shape tuple give the lengths of the corresponding array dimensions. ... Equivalent array method. ... Try it in your browser! >>> import numpy as np >>> np.shape(np.eye(3)) (3, 3) >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) ()
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.1 Manual
The elements of the shape tuple give the lengths of the corresponding array dimensions. ... Equivalent array method. ... >>> import numpy as np >>> np.shape(np.eye(3)) (3, 3) >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) ()
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.2 Manual
The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of array dimensions to it. As with numpy.reshape, one of the new shape dimensions can be -1, in which case its value is inferred from the size of ...
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.4 Manual
The elements of the shape tuple give the lengths of the corresponding array dimensions. ... Equivalent array method. ... Try it in your browser! >>> import numpy as np >>> np.shape(np.eye(3)) (3, 3) >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) ()
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-array-shape
NumPy Array Shape - GeeksforGeeks
July 15, 2025 - The shape of an array can be defined as the number of elements in each dimension. Dimension is the number of indices or subscripts, that we require in order to specify an individual element of an array.
🌐
Programiz
programiz.com › python-programming › numpy › methods › shape
NumPy shape()
The shape() method returns the shape of an array i.e. the number of elements in each dimension. import numpy as np array = np.array([[0, 1], [2, 3]])
Find elsewhere
🌐
Medium
medium.com › @amit25173 › understanding-numpy-shape-6fbb6b83891e
Understanding numpy.shape. If you think you need to spend $2,000… | by Amit Yadav | Medium
February 9, 2025 - For a 1D array, the shape might look like (n,), where n is the number of elements. For a 3D array, it could look like (x, y, z), representing depth, rows, and columns. Here’s another quick example to make it more fun. You might wonder: “What if I have a 3D array?” Let’s explore that: # Creating a 3D NumPy array array_3d = np.array([ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]) print("3D Array Shape:", array_3d.shape)
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.5.dev0 Manual
The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of array dimensions to it. As with numpy.reshape, one of the new shape dimensions can be -1, in which case its value is inferred from the size of ...
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Get the dimensions, shape, and size of an array | note.nkmk.me
April 23, 2025 - NumPy: Add new dimensions to an array (np.newaxis, np.expand_dims) The shape of a NumPy array, i.e., the length of each dimension, is represented as a tuple and can be accessed using the shape attribute.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › shape
Python Numpy shape() - Get Array Dimensions | Vultr Docs
November 19, 2024 - The shape() function in NumPy is an essential tool for managing and manipulating multidimensional arrays. It provides insights into the dimensions of an array, which is crucial when performing array operations that require an understanding of ...
🌐
Codecademy
codecademy.com › docs › python:numpy › ndarray › .shape
Python:NumPy | ndarray | .shape | Codecademy
October 30, 2025 - The .shape attribute of a NumPy ndarray returns a tuple of integers specifying the size of the array in each dimension.
🌐
Reddit
reddit.com › r/learnpython › what's the difference between a numpy array with shape (x,) and (x, 1)?
r/learnpython on Reddit: what's the difference between a numpy array with shape (x,) and (x, 1)?
October 6, 2023 -

hey, im doing an ai thing in school and my code didnt work as expected, and after 5 hours i found out i reshaped an array from (206,) to (206,1) and that made the results wrong. and from what i understand, the shape means the length of each dimension, and length is not 0 indexed so a size of 1 would be equal to just 1D no?

🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.4 Manual
The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of array dimensions to it. As with numpy.reshape, one of the new shape dimensions can be -1, in which case its value is inferred from the size of ...
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.2 Manual
The elements of the shape tuple give the lengths of the corresponding array dimensions. ... Equivalent array method. ... >>> import numpy as np >>> np.shape(np.eye(3)) (3, 3) >>> np.shape([[1, 3]]) (1, 2) >>> np.shape([0]) (1,) >>> np.shape(0) ()
🌐
Hyperskill
hyperskill.org › university › numpy › numpy-array-shape
NumPy Array Shape
September 4, 2024 - The shape of a NumPy array is a tuple that represents the number of elements along each axis. For example, an array with shape (3, 4) has 3 rows and 4 columns. The shape directly impacts the array's size, which is the total number of elements it contains. In a 2D array with shape (3, 4), the ...
🌐
Python Guides
pythonguides.com › python-numpy-shape
NumPy Shape And Array Dimensions In Python
May 16, 2025 - The shape attribute returns a tuple showing the size of each dimension. For a 1D array, it’s simply the number of elements. For a 2D array, it’s (rows, columns). For higher dimensions, it follows the same pattern. ... Let’s use a more practical example.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.1 Manual
The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of array dimensions to it. As with numpy.reshape, one of the new shape dimensions can be -1, in which case its value is inferred from the size of ...