This works:

a = [[1, 2, 3], [4, 5, 6]]
nd_a = np.array(a)

So this should work too:

nd_a = np.array([[x for x in y] for y in a])
Answer from Marijn van Vliet on Stack Overflow
๐ŸŒ
DataCamp
campus.datacamp.com โ€บ courses โ€บ intro-to-python-for-data-science โ€บ chapter-4-numpy
2D NumPy Arrays | Python
Let's try to create one numpy array for all height and weight data of your family, like this. If you print out np_2d now, you'll see that it is a rectangular data structure: Each sublist in the list, corresponds to a row in the two dimensional numpy array. From np_2d.shape, you can see that ...
๐ŸŒ
Medium
medium.com โ€บ @bouimouass.o โ€บ what-does-a-numpy-2d-array-look-like-in-python-38752ccde895
What does a numpy 2D array look like in python? | by Omar | Medium
July 23, 2023 - import numpy as np # Create a 2D array with 3 rows and 4 columns array = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) # Print the array print(array)
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ arrays.ndarray.html
The N-dimensional array (ndarray) โ€” NumPy v2.5 Manual
The array can be indexed using Python container-like syntax: >>> # The element of x in the *second* row, *third* column, namely, 6. >>> x[1, 2] 6 ยท For example slicing can produce views of the array:
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-numpy-2d-array
Create A 2D NumPy Array In Python (5 Simple Methods)
May 16, 2025 - The shape attribute tells us this is a 3ร—3 array, and ndim confirms itโ€™s a 2D array. This method is perfect when you already have your data structured in lists. ... When you need to initialize arrays with specific values, NumPy provides several convenient functions.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ user โ€บ absolute_beginners.html
NumPy: the absolute basics for beginners โ€” NumPy v2.6.dev0 Manual
To add the rows or the columns in a 2D array, you would specify the axis. ... Learn more about basic operations here. There are times when you might want to carry out an operation between an array and a single number (also called an operation between a vector and a scalar) or between arrays of two different sizes. For example, your array (weโ€™ll call it โ€œdataโ€) might contain information about distance in miles but you want to convert the information to kilometers.
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ numpy โ€บ python-numpy-exercise-37.php
Python NumPy: Create a 2-dimensional array of size 2 x 3 - w3resource
August 29, 2025 - ... # Importing the NumPy library with an alias 'np' import numpy as np # Creating a 2D NumPy array with two rows and three columns with data type np.int32 x = np.array([[2, 4, 6], [6, 8, 10]], np.int32) # Checking and displaying the type of ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ numpy โ€บ numpy_creating_arrays.asp
NumPy Creating Arrays
type(): This built-in Python function tells us the type of the object passed to it. Like in above code it shows that arr is numpy.ndarray type. To create an ndarray, we can pass a list, tuple or any array-like object into the array() method, and it will be converted into an ndarray:
Find elsewhere
๐ŸŒ
Drbeane
drbeane.github.io โ€บ python_dsci โ€บ pages โ€บ array_2d.html
2-Dimensional Arrays โ€” Python for Data Science
Notice that the array that is printed above is not displayed in the form of a column. In fact, when slicing a single row or a column out of a 2D array, the result is returned as a simple 1D array. Every Numpy array comes equipped with a shape attribute that we can use to determine the shape of the array.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ numpy โ€บ ndarray-creation
NumPy N-D Array Creation (With Examples)
To create multidimensional arrays from scratch we use functions such as ... The np.zeros() function allows us to create N-D arrays filled with all zeros. For example, ... # create 2D array with 2 rows and 3 columns filled with zeros array1 = np.zeros((2, 3)) print("2-D Array: ") print(array1)
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ multi-dimensional-arrays-in-python
Multi-Dimensional Arrays in Python โ€“ Matrices Explained with Examples
December 11, 2025 - To create a multi-dimensional array using NumPy, we can use the np.array() function and pass in a nested list of values as an argument. The outer list represents the rows of the array, and the inner lists represent the columns. Here is an example of how to create a 2-dimensional array using NumPy:
๐ŸŒ
OpenGenus
iq.opengenus.org โ€บ 2d-array-in-numpy
2D Arrays in NumPy (Python)
October 28, 2022 - There are various built-in functions used to initialize an array Zeros Array zeros((r,c)) - It will return an array with all elements zeros with r number of rows and c number of columns.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ user โ€บ basics.creation.html
Array creation โ€” NumPy v2.6.dev0 Manual
For example: >>> import numpy as np >>> np.linspace(1., 4., 6) array([1. , 1.6, 2.2, 2.8, 3.4, 4. ]) The advantage of this creation function is that you guarantee the number of elements and the starting and end point. The previous arange(start, stop, step) will not include the value stop.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.5 โ€บ user โ€บ basics.creation.html
Array creation โ€” NumPy v2.5 Manual
For example: >>> import numpy as np >>> np.linspace(1., 4., 6) array([1. , 1.6, 2.2, 2.8, 3.4, 4. ]) The advantage of this creation function is that you guarantee the number of elements and the starting and end point. The previous arange(start, stop, step) will not include the value stop.
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ python โ€บ define a two-dimensional array in python
Define a two-dimensional array in Python | Sentry
June 15, 2023 - The following code will create a 3-by-3 2D array with all values set to zero: import numpy matrix = numpy.zeros((3,3)) # array([[0., 0., 0.], # [0., 0., 0.], # [0., 0., 0.]])
๐ŸŒ
Indian AI Production
indianaiproduction.com โ€บ home โ€บ blog โ€บ python numpy array โ€“ create numpy ndarray (multidimensional array)
Python NumPy array - Create NumPy ndarray (multidimensional array)
June 12, 2019 - You can insert it while creating an array. import numpy as np # store student information in NumPy 2D array student_info = np.array([['id', 'name', 'percentage', 'pass or fail'], [101, 'Narendra', 80, 'pass'], [102, 'John', 75, 'pass'], [103, 'Abraham',33, 'fail'], [104, 'Oprah',52, 'pass'] ]) print(student_info)
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ matplotlib โ€บ how to visualize a 2d array?
How to Visualize a 2D Array? | Scaler Topics
June 5, 2024 - Matplotlib and Numpy provide the modules and functions to visualize a 2D array in Python. To visualize an array or list in matplotlib, we have to generate the data, which the NumPy library can do, and then plot the data using matplotlib. There are many functions by which we can add data to the array numpy.array(), numpy.arange(), numpy.linspace(), etc.
๐ŸŒ
DataCamp
campus.datacamp.com โ€บ courses โ€บ intro-to-python-for-data-science โ€บ chapter-4-numpy
Your First 2D NumPy Array | Python
import numpy as np baseball = [[180, 78.4], [215, 102.7], [210, 98.5], [188, 75.2]] # Create a 2D numpy array from baseball: np_baseball # Print out the type of np_baseball # Print out the shape of np_baseball
๐ŸŒ
Data Science Dojo
discuss.datasciencedojo.com โ€บ python
How to create a two-dimensional array using NumPy? - Python - Data Science Dojo Discussions
May 15, 2023 - I have comprehended multiple methods that assist me in defining a one-dimensional array using NumPy. Now, I aspire to master methods that help in developing a two-dimensional array. For this purpose, I have found one metโ€ฆ