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 OverflowNumPy
numpy.org βΊ doc βΊ stable βΊ reference βΊ arrays.ndarray.html
The N-dimensional array (ndarray) β NumPy v2.5 Manual
An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a tuple of N non-negative integers that specify the sizes of each dimension. The type of items in the array is ...
06:37
How to create '2D' Array in Numpy | Python NumPy Tutorial for ...
07:52
How to Create NumPy Arrays in Python | Shape, Dimensions, Size ...
02:20
Create a Matrix (2D array) in NumPy Python | Module NumPy Tutorial ...
07:43
NumPy multidimensional arrays are easy! π§ - YouTube
16:05
NumPy Techniques and Practical Examples: Populating & Changing ...
Top answer 1 of 3
21
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])
2 of 3
11
To create a new array, it seems numpy.zeros is the way to go
import numpy as np
a = np.zeros(shape=(x, y))
You can also set a datatype to allocate it sensibly
>>> np.zeros(shape=(5,2), dtype=np.uint8)
array([[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0]], dtype=uint8)
>>> np.zeros(shape=(5,2), dtype="datetime64[ns]")
array([['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000'],
['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000'],
['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000'],
['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000'],
['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000']],
dtype='datetime64[ns]')
See also
- How do I create an empty array/matrix in NumPy?
- np.full(size, 0) vs. np.zeros(size) vs. np.empty()
NumPy
numpy.org βΊ devdocs βΊ user βΊ absolute_beginners.html
NumPy: the absolute basics for beginners β NumPy v2.6.dev0 Manual
Using np.newaxis will increase the dimensions of your array by one dimension when used once. This means that a 1D array will become a 2D array, a 2D array will become a 3D array, and so on.
NumPy
numpy.org βΊ devdocs βΊ reference βΊ arrays.ndarray.html
The N-dimensional array (ndarray) β NumPy v2.6.dev0 Manual
An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a tuple of N non-negative integers that specify the sizes of each dimension. The type of items in the array is ...
NumPy
numpy.org βΊ doc βΊ 2.1 βΊ reference βΊ arrays.ndarray.html
The N-dimensional array (ndarray) β NumPy v2.1 Manual
An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a tuple of N non-negative integers that specify the sizes of each dimension. The type of items in the array is ...
NumPy
numpy.org βΊ doc βΊ stable βΊ user βΊ basics.creation.html
Array creation β NumPy v2.5 Manual
>>> import numpy as np >>> np.diag([1, 2, 3]) array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]) >>> np.diag([1, 2, 3], 1) array([[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3], [0, 0, 0, 0]]) >>> a = np.array([[1, 2], [3, 4]]) >>> np.diag(a) array([1, 4]) vander(x, n) defines a Vandermonde matrix as a 2D NumPy array.
NumPy
numpy.org βΊ doc βΊ 2.4 βΊ reference βΊ arrays.ndarray.html
The N-dimensional array (ndarray) β NumPy v2.4 Manual
An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a tuple of N non-negative integers that specify the sizes of each dimension. The type of items in the array is ...
Python.org
discuss.python.org βΊ python help
2D NumPy array of objects vs. 2D Python list efficiency - Python Help - Discussions on Python.org
March 9, 2023 - I have a 2D list a of varying shape NumPy arrays and equivalent NumPy array of objects b = np.array(a, dtype='object'). It is inconvenient to slice a, e.g. a[:][1] is not equivalent to b[:, 1], canβt be expressed by slicing and requires a list comprehension [e[1] for e in a[:]] instead.
GeeksforGeeks
geeksforgeeks.org βΊ python βΊ manipulating-multidimensional-arrays-in-python-numpy
Manipulating Multidimensional Arrays in Python NumPy - GeeksforGeeks
February 19, 2026 - 3. 2D Array from List of Tuples: NumPy arrays can also be created from a list of tuples, with each tuple representing a row in the array.
YouTube
youtube.com βΊ watch
NumPy multidimensional arrays are easy! π§ - YouTube
#coding #python #numpy import numpy as nparray = np.array([[['A', 'B', 'C'], ['D', 'E', 'F'], ['G', 'H', 'I']], [['J', 'K', 'L']
Published: July 24, 2025
LinkedIn
linkedin.com βΊ posts βΊ imyasinislam_imageprocessing-computervision-python-activity-7437378023739305984-WNT0
Lumina: AI Foundation Match Finder with Computer Vision
Login to LinkedIn to keep in touch with people you know, share ideas, and build your career.
Pygame
pygame.org βΊ docs
Pygame Front Page β pygame v2.6.0 documentation
Pygame used the NumPy python module to allow efficient per pixel effects on images. Using the surface arrays is an advanced feature that allows custom effects and filters.
Instagram
instagram.com βΊ popular βΊ numpy-2d-array-matrix
Numpy 2d Array Matrix
March 19, 2026 - Welcome back to Instagram. Sign in to see what your friends, family and interests have been capturing and sharing around the world.
SciPy
docs.scipy.org βΊ doc βΊ scipy βΊ reference βΊ generated βΊ scipy.stats.binned_statistic_2d.html
binned_statistic_2d β SciPy v1.18.0 Manual
binnumber(N,) array of ints or (2,N) ndarray of ints Β· This assigns to each element of sample an integer that represents the bin in which this observation falls. The representation depends on the expand_binnumbers argument. See Notes for details. See also Β· numpy.digitize, numpy.histogram2d, binned_statistic, binned_statistic_dd Β·