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
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ numpy โ€บ numpy_creating_arrays.asp
NumPy Creating Arrays
NumPy is used to work with arrays. The array object in NumPy is called ndarray. We can create a NumPy ndarray object by using the array() function.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ numpy โ€บ ndarray-creation
NumPy N-D Array Creation (With Examples)
May 22, 2023 - 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)
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-numpy-create-2d-array
Create 2D Array in NumPy
The function returns a numpy array with specified shape, and all elements in the array initialised to ones. import numpy as np # create a 2D array with shape (3, 4) shape = (3, 4) arr = np.ones(shape) print(arr)
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ user โ€บ basics.creation.html
Array creation โ€” NumPy v2.5 Manual
vander(x, n) defines a Vandermonde matrix as a 2D NumPy array. Each column of the Vandermonde matrix is a decreasing power of the input 1D array or list or tuple, x where the highest polynomial order is n-1. This array creation routine is helpful in generating linear least squares models, as such:
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-numpy-2d-array
Create A 2D NumPy Array In Python (5 Simple Methods)
May 9, 2025 - Cells, rows, columns and slices of a 2D sales array. import numpy as np matrix = [[1, 2], [3, 4]] matrix.append([5, 6]) # add a row to a nested list for row in matrix: row.append(0) # add a column print(matrix) arr = np.array([[1, 2], [3, 4]]) ...
๐ŸŒ
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 - x = np.array([[2, 4, 6], [6, 8, 10]], np.int32): The current line creates a two-dimensional NumPy array x with two rows and three columns using the provided list of lists.
๐ŸŒ
Drbeane
drbeane.github.io โ€บ python_dsci โ€บ pages โ€บ array_2d.html
2-Dimensional Arrays โ€” Python for Data Science
Numpy provides two functions for concatenating arrays: hstack(), or horizontal stack, and vstack(), or vertical stack. As the names imply, these functions allow us to create new arrays by horizontally or vertically stacking arrays, as long as stacked arrays have the same sizes along the dimension in which the stacking occurs (columns for hstack() and rows for vstack()).
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ python โ€บ define a two-dimensional array in python
Python Define a Two-Dimensional Array or Matrix | Sentry
September 23, 2026 - 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.]])
Find elsewhere
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ how to create a two dimensional array in python?
How To Create a Two Dimensional Array in Python? - Be on the Right Side of Change
June 11, 2022 - Numpy once again has the solution to your problem as you can use the numpy.arrange() method to reshape a list into a 2D array. Example: Letโ€™s convert the list li = [1,2,3,4,5,6,7,8,9] to a n*n 2D array.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ manipulating-multidimensional-arrays-in-python-numpy
Manipulating Multidimensional Arrays in Python NumPy - GeeksforGeeks
February 19, 2026 - Each nested structure represents a new dimension in the array. 1. 2D Array from List of Lists: NumPy's np.array() function can create a 2D array from a list of lists, where each sub-list represents a row in ...
๐ŸŒ
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)
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ multi-dimensional-arrays-in-python
Multi-Dimensional Arrays in Python โ€“ Matrices Explained with Examples
December 11, 2025 - In this example, we create a 2-dimensional array using the np.array() function, and then use slicing to access a subarray that contains rows 0 through 1 and columns 1 through 2. We then modify the subarray by multiplying it by 2, and print the ...
๐ŸŒ
MLJAR
mljar.com โ€บ answers โ€บ define-two-dimensional-array-python
Define two-dimensional array in Python
array[2][2] = 5 # valid array[7][2] = 3 # error ยท This way is much easier. You can use zeros function from numpy to create 2D array with all values set to zero: import numpy array = numpy.zeros((4,4)) REMEMBER Even though the second version is easier, the first one is better for this operation unless we need any matrix operations.
๐ŸŒ
PyTutorial
pytutorial.com โ€บ python-2d-arrays-guide-lists-numpy-examples
PyTutorial | Python 2D Arrays Guide: Lists, NumPy, Examples
March 25, 2026 - Python does not have a built-in 2D array type. But we can create them easily. The most common ways are using nested lists or the NumPy library.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ user โ€บ basics.creation.html
Array creation โ€” NumPy v2.6.dev0 Manual
vander(x, n) defines a Vandermonde matrix as a 2D NumPy array. Each column of the Vandermonde matrix is a decreasing power of the input 1D array or list or tuple, x where the highest polynomial order is n-1. This array creation routine is helpful in generating linear least squares models, as such:
๐ŸŒ
Codecademy
codecademy.com โ€บ article โ€บ numpy-arrays-guide
Creating and Using NumPy Arrays - A Complete Guide | Codecademy
Next, letโ€™s discuss the different types of arrays in NumPy. Letโ€™s start with 0D arrays. A 0D array, also known as a scalar, is an array that contains a single element. Here is an example: ... A 1-D array, also known as a vector, is an array that contains a sequence of elements in it. This sequence of elements can be laid out as a row or column. ... A 2D array, also known as a matrix, is an array that contains a table of elements with rows and columns.
๐ŸŒ
Medium
medium.com โ€บ @monjurmbm404 โ€บ numpy-series-04-numpy-2d-arrays-matrix-basics-rows-columns-and-subarrays-27503a64b887
NumPy 2D Arrays: Matrix Basics, Rows, Columns and Subarrays | by Engr. Md Monjur Bakth Mazumder | Sep, 2026 | Medium
1 week ago - ... # Create a 2D array data = np.array([ [10, 20, 30], [40, 50, 60], [70, 80, 90] ])# Dimensions print("Dimensions:", data.ndim)# Shape print("Shape:", data.shape)# Specific element print("Element:", data[1, 2])# First row print("First row:", ...
๐ŸŒ
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 - In machine learning and data science NumPy 1D array known as vector. Specially use to store and perform an operation on target values. To create NumPy 2D array use array() function and give one argument of items of lists of the list to it.