If you restrict yourself to the Python standard library, then a list of lists is the closest construct:

arr = [[1,2],[3,4]]

gives a 2d-like array. The rows can be accessed as arr[i] for i in {0,..,len(arr}, but column access is difficult.

If you are willing to add a library dependency, the NumPy package is what you really want. You can create a fixed-length array from a list of lists using:

import numpy
arr = numpy.array([[1,2],[3,4]])

Column access is the same as for the list-of-lists, but column access is easy: arr[:,i] for i in {0,..,arr.shape[1]} (the number of columns).

In fact NumPy arrays can be n-dimensional.

Empty arrays can be created with

numpy.empty(shape)

where shape is a tuple of size in each dimension; shape=(1,3,2) gives a 3-d array with size 1 in the first dimension, size 3 in the second dimension and 2 in the 3rd dimension.

If you want to store objects in a NumPy array, you can do that as well:

 arr = numpy.empty((1,), dtype=numpy.object)
 arr[0] = 'abc'

For more info on the NumPy project, check out the NumPy homepage.

Answer from Barry Wark on Stack Overflow
🌐
CodeSignal
codesignal.com › learn › courses › multidimensional-arrays-and-their-traversal-in-python › lessons › exploring-the-dimensions-a-beginners-guide-to-multidimensional-arrays-in-python
A Beginner's Guide to Multidimensional Arrays in Python
Our goal today is to strengthen your foundational knowledge of these 'apartment buildings' and how to handle them effectively in Python. To construct a multidimensional or nested array in Python, we use lists inside lists.
🌐
AskPython
askpython.com › python › array › multidimensional-arrays
Multidimensional Arrays in Python: A Complete Guide - AskPython
February 27, 2023 - In this article, the creation and implementation of multidimensional arrays (2D, 3D as well as 4D arrays) have been covered along with examples in Python Programming language. To understand and implement multi-dimensional arrays in Python, the NumPy package is used.
🌐
freeCodeCamp
freecodecamp.org › news › multi-dimensional-arrays-in-python
Multi-Dimensional Arrays in Python – Matrices Explained with Examples
December 11, 2025 - You'll commonly use these types ... videos, and scientific data. In Python, you can create multi-dimensional arrays using various libraries, such as NumPy, Pandas, and TensorFlow....
🌐
Python Like You Mean It
pythonlikeyoumeanit.com › Module3_IntroducingNumpy › AccessingDataAlongMultipleDimensions.html
Accessing Data Along Multiple Dimensions in an Array — Python Like You Mean It
Keeping track of the meaning of an array’s various dimensions can quickly become unwieldy when working with real datasets. xarray is a Python library that provides functionality comparable to NumPy, but allows users provide explicit labels for an array’s dimensions; that is, you can name each dimension.
🌐
GeeksforGeeks
geeksforgeeks.org › python › multi-dimensional-lists-in-python
Multi-dimensional Lists in Python - GeeksforGeeks
October 30, 2025 - In Python, a Multi-dimensional List is a list containing other lists, often used to represent structured data like matrices, tables or 2D arrays. It’s useful for storing and accessing data in rows and columns, commonly applied in data analysis, ...
Find elsewhere
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › multidimensional array in python
Multidimensional Array in Python | Creating a Multidimensional List
April 17, 2023 - Multidimensional Array concept can be explained as a technique of defining and storing the data on a format with more than two dimensions (2D). In Python, Multidimensional Array can be implemented by fitting in a list function inside another ...
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Reddit
reddit.com › r/learnpython › multidimensional arrays?
r/learnpython on Reddit: Multidimensional arrays?
September 15, 2023 -

Hello!

I have 5 sets, each set contains a number of elements of variable length (eg. set 1 has 100 elements, set 2 has 150 and so on)

Is it possible to store these sets in a single structure?

For example, if I want to print the 35th elements of the 3rd set, I could call it simply by saying something like MyContainer[setN][elementN]

I was trying to use a 2D array but I can't initialize its shape, since each set has a variable number of elements.

Can anybody point me to the right direction / best practice?

Thank you

🌐
Medium
medium.com › @rodrigobc10 › what-are-multidimensional-arrays-in-python-8ce82b8cfb41
What are Multidimensional Arrays in Python? | by Rodrigo Becerra Carrillo | Medium
August 6, 2024 - For now, let’s switch gears to Python and see how these concepts are implemented as 1D and 2D arrays. Generally speaking, an array is a data structure that contains entries of the same data type (strings, integers, floating point numbers, etc.) in contiguous addresses of memory. In NumPy you can define multidimensional arrays, also known as ndarrays, but let’s start small.
🌐
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 ...
🌐
Snakify
snakify.org › two-dimensional lists (arrays)
Two-dimensional lists (arrays) - Learn Python 3 - Snakify
In real-world Often tasks have to store rectangular data table. [say more on this!] Such tables are called matrices or two-dimensional arrays. In Python any table can be represented as a list of lists (a list, where each element is in turn a list).
🌐
NumPy
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 ...
🌐
Python
peps.python.org › pep-0209
PEP 209 – Multi-dimensional Arrays | peps.python.org
The proposed design uses four Python classes: ArrayType, UFunc, Array, and ArrayView; and a low-level C-extension module, _ufunc, to handle the array operations efficiently. In addition, each array type has its own C-extension module which defines the coercion rules, operations, and methods for that type.
🌐
Medium
soumenatta.medium.com › how-to-work-with-multidimensional-arrays-in-python-a-beginners-guide-bd437495c87
How to Work with Multidimensional Arrays in Python: A Beginner’s Guide | by Dr. Soumen Atta, Ph.D. | Medium
April 8, 2023 - One way to create a multidimensional array in Python is by using a list of lists. Each element in the list represents a row in the array, and each sub-list represents the elements in that row.
🌐
GeeksforGeeks
geeksforgeeks.org › python › indexing-multi-dimensional-arrays-in-python-using-numpy
Indexing Multi-dimensional arrays in Python using NumPy - GeeksforGeeks
November 4, 2025 - Indexing in multi-dimensional arrays allows us to access, modify or extract specific elements or sections from arrays efficiently. In Python, NumPy provides tools to handle this through index numbers, slicing and reshaping.
🌐
TutorChase
tutorchase.com › answers › ib › computer-science › how-do-you-create-and-use-multidimensional-arrays-in-python
How do you create and use multidimensional arrays in Python? | TutorChase
In Python, you can create and use multidimensional arrays using the NumPy library. Python does not have built-in support for multidimensional arrays, but the NumPy library provides this functionality. NumPy is a powerful library for numerical computations in Python.
🌐
Code-knowledge
code-knowledge.com › hem › multidimensional array in python
Multidimensional Array in Python - Learn Java and Python for free
December 20, 2021 - A multidimensional array in Python consisting of two dimensions can be interpreted as a grid, three dimensions are similar to a block.
🌐
University at Buffalo
math.buffalo.edu › ~badzioch › MTH337 › PT › PT-multidimensional_numpy_arrays › PT-multidimensional_numpy_arrays.html
Multidimensional numpy arrays — MTH 337
One way to create such array is to start with a 1-dimensional array and use the numpy reshape() function that rearranges elements of that array into a new shape.
🌐
TutorialsPoint
tutorialspoint.com › article › accessing-data-along-multiple-dimensions-arrays-in-python-numpy
Accessing Data Along Multiple Dimensions Arrays in Python Numpy
March 27, 2026 - NumPy arrays support flexible indexing and slicing across multiple dimensions using row and column indices.