By selecting the 0th column in particular, as you've noticed, you reduce the dimensionality:

>>> m = np.random.normal(0, 1, size=(5, 2))
>>> m[:,0].shape
(5,)

You have a lot of options to get a 5x1 object back out. You can index using a list, rather than an integer:

>>> m[:, [0]].shape
(5, 1)

You can ask for "all the columns up to but not including 1":

>>> m[:,:1].shape
(5, 1)

Or you can use None (or np.newaxis), which is a general trick to extend the dimensions:

>>> m[:,0,None].shape
(5, 1)
>>> m[:,0][:,None].shape
(5, 1)
>>> m[:,0, None, None].shape
(5, 1, 1)

Finally, you can reshape:

>>> m[:,0].reshape(5,1).shape
(5, 1)

but I'd use one of the other methods for a case like this.

Answer from DSM on Stack Overflow
🌐
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.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.6.dev0 Manual
Tuple of array dimensions. 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 ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-array-shape
NumPy Array Shape - GeeksforGeeks
July 15, 2025 - Dimension is the number of indices ... array. In NumPy, we will use an attribute called shape which returns a tuple, the elements of the tuple give the lengths of the corresponding array dimensions....
🌐
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?

Find elsewhere
🌐
Medium
medium.com › @techwithjulles › numpy-arrays-array-shape-and-dimensions-879b7592cf44
Numpy Arrays — Array Shape and Dimensions | by TechwithJulles | Medium
November 16, 2023 - The output of the .shape attribute shows us that the new array has a shape of (2, 3). The dimension of a NumPy array refers to the number of axes of the array.
🌐
Programiz
programiz.com › python-programming › numpy › methods › shape
NumPy shape() | Programiz
August 30, 2023 - The shape() method returns the shape of an array as a tuple.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.2 Manual
Tuple of array dimensions. 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 ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › how to get numpy array shape?
How to Get NumPy Array Shape? - Spark By {Examples}
February 13, 2025 - To get the shape of a Python NumPy array use numpy.ndarray.shape property. The array shape can be defined as the number of elements in each dimension and
🌐
Vultr Docs
docs.vultr.com › python › third party › numpy › shape()
Python Numpy shape() - Get Array Dimensions
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 ...
🌐
University of Utah
web.physics.utah.edu › ~detar › lessons › python › numpy_arrays › node6.html
Array shape
The array M in the example has five rows and three columns. To get its shape, use the shape value that comes with numpy arrays.
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_reshape.asp
NumPy Array Reshaping
The shape of an array is the number of elements in each dimension.
🌐
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. It provides information about the structure and layout of the array.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.shape.html
numpy.shape — NumPy v2.6.dev0 Manual
>>> a = np.array([(1, 2), (3, 4), (5, 6)], ... dtype=[('x', 'i4'), ('y', 'i4')]) >>> np.shape(a) (3,) >>> a.shape (3,)
🌐
DEV Community
dev.to › mariazayed › understanding-array-shapes-in-numpy-4j9m
Understanding Array Shapes in NumPy - DEV Community
November 18, 2023 - Just like you can’t put together puzzles with different numbers of pieces, you can’t do certain things if arrays don’t have the right shapes.
🌐
Data Science Dojo
discuss.datasciencedojo.com › python
What are the different methods to find the shape of a Numpy array? - Python - Data Science Dojo Discussions
November 9, 2022 - python, numpy, array · Hyder_Zaidi November 9, 2022, 2:59pm · #1 · To determine the shape of a NumPy array, you can utilize the shape attribute, which provides a tuple representing the number of rows and columns.
🌐
Interactive Chaos
interactivechaos.com › en › python › function › ndarrayshape
ndarray.shape | Interactive Chaos
January 21, 2019 - Python scenarios · Full name · ndarray.shape · Library · NumPy · Syntax · ndarray.shape · Description · The numpy.ndarray.shape attribute returns a tuple with the size of the array, but can also be used to resize it.
🌐
CodeSignal
codesignal.com › learn › courses › numpy-basics › lessons › array-shape-and-reshape
Array Shape and Reshape
NumPy provides an easy way to find an array's shape with the shape attribute. It's like getting the length of a list of toys in a box, which is the total number of toys, or the size of our array. Python ·
🌐
Medium
medium.com › @amit25173 › numpy-shape-in-python-6cfe7cb20084
numpy.shape in Python. If you think you need to spend $2,000… | by Amit Yadav | Medium
February 9, 2025 - Let’s dive into some practical uses of shape. ... Imagine you’re given a long list of numbers, but you need them organized neatly into rows and columns. That’s where reshape() comes in. It lets you rearrange the data while keeping all elements intact. ... import numpy as np # Reshaping a 1D array into a 2D array array = np.array([1, 2, 3, 4, 5, 6]) print("Original array:", array) print("Original shape:", array.shape) # Reshape the array to 2 rows and 3 columns reshaped_array = array.reshape(2, 3) print("\nReshaped array:\n", reshaped_array) print("New shape:", reshaped_array.shape)