It all depends on what you plan to do with the array. If all you're doing is creating arrays of simple data types and doing I/O, the array module will do just fine.

If, on the other hand, you want to do any kind of numerical calculations, the array module doesn't provide any help with that. NumPy (and SciPy) give you a wide variety of operations between arrays and special functions that are useful not only for scientific work but for things like advanced image manipulation or in general anything where you need to perform efficient calculations with large amounts of data.

Numpy is also much more flexible, e.g. it supports arrays of any type of Python objects, and is also able to interact "natively" with your own objects if they conform to the array interface.

Answer from dF. on Stack Overflow
Top answer
1 of 3
83

It all depends on what you plan to do with the array. If all you're doing is creating arrays of simple data types and doing I/O, the array module will do just fine.

If, on the other hand, you want to do any kind of numerical calculations, the array module doesn't provide any help with that. NumPy (and SciPy) give you a wide variety of operations between arrays and special functions that are useful not only for scientific work but for things like advanced image manipulation or in general anything where you need to perform efficient calculations with large amounts of data.

Numpy is also much more flexible, e.g. it supports arrays of any type of Python objects, and is also able to interact "natively" with your own objects if they conform to the array interface.

2 of 3
5

Small bootstrapping for the benefit of whoever might find this useful (following the excellent answer by @dF.):

import numpy as np
from array import array

# Fixed size numpy array
def np_fixed(n):
    q = np.empty(n)
    for i in range(n):
        q[i] = i
    return q

# Resize with np.resize
def np_class_resize(isize, n):
    q = np.empty(isize)
    for i in range(n):
        if i>=q.shape[0]:
            q = np.resize(q, q.shape[0]*2)        
        q[i] = i
    return q    

# Resize with the numpy.array method
def np_method_resize(isize, n):
    q = np.empty(isize)
    for i in range(n):
        if i>=q.shape[0]:
            q.resize(q.shape[0]*2)
        q[i] = i
    return q

# Array.array append
def arr(n):
    q = array('d')
    for i in range(n):
        q.append(i)
    return q

isize = 1000
n = 10000000

The output gives:

%timeit -r 10 a = np_fixed(n)
%timeit -r 10 a = np_class_resize(isize, n)
%timeit -r 10 a = np_method_resize(isize, n)
%timeit -r 10 a = arr(n)

1 loop, best of 10: 868 ms per loop
1 loop, best of 10: 2.03 s per loop
1 loop, best of 10: 2.02 s per loop
1 loop, best of 10: 1.89 s per loop

It seems that array.array is slightly faster and the 'api' saves you some hassle, but if you need more than just storing doubles then numpy.resize is not a bad choice after all (if used correctly).

🌐
GeeksforGeeks
geeksforgeeks.org › python › python-built-in-array-vs-numpy-array
Python - Built-in array vs NumPy array - GeeksforGeeks
January 25, 2022 - And inbuilt array module when the desired data type of array was Unicode character specified by typecode 'u', and the floating value was sent to array. TypeError occurred that 'array item must be Unicode character'. But in numpy array when the desired data type of array was int and float value was sent to array.
Top answer
1 of 3
10
Python array the term is "Python list" usage: everyday plain Python code NumPy array: data manipulation that needs to be fast can use Python lists if speed isn't a concern supports fast and convenient vectorized functions: write np.sqrt(array) instead of [math.sqrt(number) for number in your_list] elegantly handles arbitrary number of dimensions Pandas dataframe: for data wrangling in SQL-like language similar to in-memory SQLite database supports NumPy's vectorized functions basically a glorified NumPy array with column names
2 of 3
2
This a great question that also requires a lot of info to cover! I’ll do my best to stay on topic, but there’s so much nuance I might veer off topic a little. Let’s call “Python Arrays” Lists, since that’s mostly how the Python documentation refers to them. Lists are containers which are provided as part of the programming language. Lists are really versatile and Python provides lots of habdy builtin functions you can do with lists. NumPy arrays are indeed very similar to lists, but they were specifically designed for doing lots of number crunching in a very efficient manner. Sure, they can often be used interchangeably with lists, but if you had to calculate something like a Matrix-vector product, and you had to do it millions of times, NumPy would let you do it much faster than you ever could with Lists. Think NumPy arrays as being specialized lists. DataFrames are a bit more complex than both Lists and NumPy Arrays. I’ve seen them compared to spreadsheets quite often, and that’s a good frame of reference for getting started with DataFrames. DataFrames are tabular, like spreadsheet in Excel. Like spreadsheets, DataFrames are useful for cleaning, rearranging, and processing all sorts of data. If you’re interested in seeing DataFrames in action, I highly recommend you check out r/learnmachinelearning ! There are plenty of resources there for getting started. If you’re curious, I can go a bit more into the “why” for each, but I’d prefer to answer specific questions if anyone has any! To summarize: By default, always consider Lists first. They’re a great jack of all trades If you’re doing lots of number crunching, you might benefit for NumPy Arrays. They’re especially good when you need to work with multi-dimensional containers and access them in very specific patterns. DataFrames are more complex than either, but offer the most flexibility and structure. If you need to process something like stock prices, voting records, the CIA World Factbook, or even sometimes application logs, DataFrames can be really handy at providing functionality which you’d otherwise have to add yourself on top of Numpy Arrays or Lists.
🌐
Medium
vandroidsri.medium.com › arrays-vs-numpy-arrays-vs-list-9ca70bfb0212
Arrays vs NumPy Arrays vs List. On learning NumPy lots of confusion… | by Vandana Srivastava | Medium
July 22, 2024 - NumPy Array: Best for numerical and scientific computing, supports advanced mathematical operations, and is highly efficient. Python List: More versatile and flexible, suitable for general purposes, supports heterogeneous elements, but less ...
🌐
Note.nkmk.me
note.nkmk.me › home › python
List vs. Array vs. numpy.ndarray in Python | note.nkmk.me
February 5, 2024 - Although often confused, the correct type is ndarray, not array, where "nd" stands for N-dimensional. The numpy.array() function creates an ndarray.
🌐
Reddit
reddit.com › r/python › is it ever advantageous to use a standard python list vs a numpy array when all elements are the same type?
r/Python on Reddit: Is it ever advantageous to use a standard Python list vs a numpy array when all elements are the same type?
December 8, 2020 -

I'm wondering if there is a use case where lists are better than numpy arrays besides storing multiple types of data in a relatively small/low dimension list (say i just want a quick-and-dirty list to store some constants i want to call on later?

I'm not well versed enough in how processors/memory work to know if I'm missing something else obvious. I know it won't make a huge performance impact anyways if you don't actually have a lot of math or large lists/arrays to work with, but I've been diving deeper into how numpy/pandas function at a basic level and it got me thinking about this.

🌐
GeeksforGeeks
geeksforgeeks.org › python-lists-vs-numpy-arrays
Python Lists VS Numpy Arrays - GeeksforGeeks
Functionality: Lists can store any data type, but lack specialized NumPy functions for numerical operations. Homogeneous Data: NumPy arrays store elements of the same data type, making them more compact and memory-efficient than lists.
Published: April 28, 2025
🌐
NumPy
numpy.org › doc › stable › user › whatisnumpy.html
What is NumPy? — NumPy v2.5 Manual
At the core of the NumPy package, is the ndarray object. This encapsulates n-dimensional arrays of homogeneous data types, with many operations being performed in compiled code for performance. There are several important differences between NumPy arrays and the standard Python sequences:
Find elsewhere
Top answer
1 of 3
8

To understand the differences between numpy and array, I ran a few more quantitative test.

What I have found is that, for my system (Ubuntu 18.04, Python3), array seems to be twice as fast at generating a large array from the range generator compared to numpy (although numpy's dedicated np.arange() seems to be much faster -- actually too fast, and perhaps it is caching something during tests), but twice as slow than using list.

However, quite surprisingly, array objects seems to be larger than the numpy counterparts. Instead, the list objects are roughly 8-13% larger than array objects (this will vary with the size of the individual items, obviously). Compared to list, array offers a way to control the size of the number objects.

So, perhaps, the only sensible use case for array is actually when numpy is not available.

For completeness, here is the code that I used for the tests:

import numpy as np
import array
import sys

num = int(1e6)
num_i = 100
x = np.logspace(1, int(np.log10(num)), num_i).astype(int)

%timeit list(range(num))
# 10 loops, best of 3: 32.8 ms per loop

%timeit array.array('l', range(num))
# 10 loops, best of 3: 86.3 ms per loop

%timeit np.array(range(num), dtype=np.int64)
# 10 loops, best of 3: 180 ms per loop

%timeit np.arange(num, dtype=np.int64)
# 1000 loops, best of 3: 809 µs per loop


y_list = np.array([sys.getsizeof(list(range(x_i))) for x_i in x])
y_array = np.array([sys.getsizeof(array.array('l', range(x_i))) for x_i in x])
y_np = np.array([sys.getsizeof(np.array(range(x_i), dtype=np.int64)) for x_i in x])

import matplotlib.pyplot as plt

plt.figure(figsize=(12, 6))
plt.plot(x, y_list, label='list')
plt.plot(x, y_array, label='array')
plt.plot(x, y_np, label='numpy')
plt.legend()
plt.show()

2 of 3
0

Yes, if you don't want another dependency in your code.

🌐
Plain English
plainenglish.io › home › blog › python › difference between python list and numpy array
Difference Between Python List and NumPy Array
July 11, 2021 - So, if you're dealing with a large data, using an array for your data is a good option. Originally, Python is not designed for a numerical operations. In numpy, the tasks are broken into small segments for then processed in parallel.
🌐
Data Leads Future
dataleadsfuture.com › python-lists-vs-numpy-arrays-a-deep-dive-into-memory-layout-and-performance-benefits
Python Lists Vs. NumPy Arrays: A Deep Dive into Memory Layout and Performance Benefits
December 19, 2025 - When you traverse a Python list, you need to look up the memory location of each object based on the pointer, resulting in lower performance. Next, let’s explore the components and arrangement of NumPy arrays, and how it benefits cache locality and vectorization.
🌐
Sololearn
sololearn.com › en › Discuss › 2297609 › what-s-difference-between-numpy-arrays-and-normal-arrays-from-array-module-in-python
what's difference between numpy arrays and normal arrays from array module in python? | Sololearn: Learn to code for FREE!
First of all, they are less flexible than lists - you can only store one-type variables there. Second of all, you can't really do matrix operations on them efficiently, the array module has no such implementation ready.
🌐
Towards Data Science
towardsdatascience.com › home › latest › python lists vs. numpy arrays: a deep dive into memory layout and performance benefits
Python Lists Vs. NumPy Arrays: A Deep Dive into Memory Layout and Performance Benefits | Towards Data Science
March 5, 2025 - Since the items are all grouped by category, you can quickly find a book without having to search through many boxes. This is why NumPy arrays are faster than native Python lists in many operations.
🌐
New York University
physics.nyu.edu › pine › pymanual › html › chap3 › chap3_arrays.html
3. Strings, Lists, Arrays, and Dictionaries — PyMan 0.9.31 documentation
The NumPy library has a large set of routines for creating, manipulating, and transforming NumPy arrays. NumPy functions, like sqrt and sin, are designed specifically to work with NumPy arrays. Core Python has an array data structure, but it’s not nearly as versatile, efficient, or useful as the NumPy array.
🌐
NumPy
numpy.org › doc › stable › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.5 Manual
NumPy (Numerical Python) is an open source Python library that’s widely used in science and engineering. The NumPy library contains multidimensional array data structures, such as the homogeneous, N-dimensional ndarray, and a large library of functions that operate efficiently on these data ...
Top answer
1 of 7
15

You first need to understand the difference between arrays and lists.

An array is a contiguous block of memory consisting of elements of some type (e.g. integers).

You cannot change the size of an array once it is created.
It therefore follows that each integer element in an array has a fixed size, e.g. 4 bytes.

On the other hand, a list is merely an "array" of addresses (which also have a fixed size).

But then each element holds the address of something else in memory, which is the actual integer that you want to work with. Of course, the size of this integer is irrelevant to the size of the array. Thus you can always create a new (bigger) integer and "replace" the old one without affecting the size of the array, which merely holds the address of an integer.

Of course, this convenience of a list comes at a cost: Performing arithmetic on the integers now requires a memory access to the array, plus a memory access to the integer itself, plus the time it takes to allocate more memory (if needed), plus the time required to delete the old integer (if needed). So yes, it can be slower, so you have to be careful what you're doing with each integer inside an array.

2 of 7
9

Your first example could be speed up. Python loop and access to individual items in a numpy array are slow. Use vectorized operations instead:

import numpy as np
x = np.arange(1000000).cumsum()

You can put unbounded Python integers to numpy array:

a = np.array([0], dtype=object)
a[0] += 1232234234234324353453453

Arithmetic operations compared to fixed-sized C integers would be slower in this case.

🌐
DEV Community
dev.to › chanduthedev › python-list-vs-numpy-array-3pjp
Python List vs NumPy Array - DEV Community
January 15, 2021 - Arrays: are used to store homogeneous data (same data type) of fixed size storing in sequential order in memory Lists are used to store data of growing in size and storing this data in available place anywhere(not sequential) in the memory. Almost same logic applies to Python List and NumPy Array.
🌐
Sololearn
sololearn.com › en › Discuss › 1909157 › what-the-difference-between-python-lists-and-numpy-arrays
What the difference between Python lists and NumPy arrays? | Sololearn: Learn to code for FREE!
Numpy elements have to be the same type; Due fact that Numpy is written in.C, there are significant difference in code execusion. Numpy arrays are simply much faster than typical Python lists when you operate on them
🌐
Reddit
reddit.com › r/learnpython › difference between standard library array module and using numpy arrays
r/learnpython on Reddit: Difference between standard library array module and using numpy arrays
November 13, 2019 -

This may be an odd question but I was simply curious and googling only found me articles comparing python lists to numpy arrays. (edit: for clarity, I mean here that I haven't used numpy or the builtin arrays from This module, I am familiar with python lists, how to use them and how they are implemented) I haven't used either of these which is likely part of why I don't understand the differences but I've really never seen anyone talk about the usage of the standard library module for arrays in python, only using numpy arrays to improve efficiency though they both seem to have the same job, implementing C arrays in python.

I guess my basic question is this: What is the difference between standard library arrays and numpy arrays and why do people prefer to use numpy arrays for efficient data handling?

🌐
LinkedIn
linkedin.com › pulse › python-lists-vs-numpy-arrays-mohamed-hamdy-b5e9f
Python Lists vs NumPy Arrays
Login to LinkedIn to keep in touch with people you know, share ideas, and build your career.