numpy.array is just a convenience function to create an ndarray; it is not a class itself.

You can also create an array using numpy.ndarray, but it is not the recommended way. From the docstring of numpy.ndarray:

Arrays should be constructed using array, zeros or empty ... The parameters given here refer to a low-level method (ndarray(...)) for instantiating an array.

Most of the meat of the implementation is in C code, here in multiarray, but you can start looking at the ndarray interfaces here:

https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py

Answer from wim on Stack Overflow
🌐
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.
Discussions

What are the differences between Python Array, Numpy Array and Panda Dataframe? When do I use which?
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 More on reddit.com
🌐 r/AskProgramming
24
5
October 10, 2021
Rust ndarray vs. Python NumPy Performance?

I am very curious in what you find out. Although if you are interested in pursuing machine learning at all, you should do these projects in Python (even if you do them in Rust first). The entire ML industry is very heavily geared around Python, and ML teams are unlikely to know Rust. Often they are more math focused and less comfortable with programming syntax in general, so anything that eases communication friction is advisable.

That said, I am very interested in how well Rust handles common tasks that I might do with NumPy. I was just pondering porting a noise-based image generation Python script that uses NumPy over to Rust.

More on reddit.com
🌐 r/rust
21
49
April 17, 2019
What is the difference between <class 'numpy.ndarray'> and numpy.ndarray? - Stack Overflow
I have been doing some calculations using numpy arrays and have arrived at the question of what is the difference between: and numpy.ndarray I have noticed that the More on stackoverflow.com
🌐 stackoverflow.com
Numpy vs Ndarray speed?
Numpy calls c/fortran functions under the hood. There should not be any major differences between the two in that regard. Especially as they can both use blas for linear algebra. For large arrays the overhead of python calling the underlying code in numpy should be negligible compared to the actual computation. However, -the low level code in numpy was refined over time and is battle tested. Hand made optimisations can beat rustc's. -you have more liberty to parallelize your operations in rust, especially with rayon (be careful of the overhead thought). In numpy, some blas function can be parallelized depending on your system but that's about it. Numpy can also waste time when computing long equations by allocating intermediary arrays, so a more fair comparison would be between ndarray and numexpr or numba. I agree that pyo3-numpy is very cool. But if your facing this kind of choices, benchmark to know what's best for your problem. You might be surprised. More on reddit.com
🌐 r/rust
7
0
January 26, 2025
🌐
SciPython
scipython.com › books › book2 › chapter-6-numpy › questions › npndarray-and-nparray
np.ndarray and np.array
What is the difference between the objects np.ndarray and np.array? ... An np.ndarray is a NumPy class for representing multidimensional arrays in Python; we often refer to instances of this class simply as array objects.
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.
🌐
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.
🌐
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 - Let’s check the difference between array, ndarray and list, shown below ... NumPy Array: Best for numerical and scientific computing, supports advanced mathematical operations, and is highly efficient.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › numpy › numpy-ndarray
Numpy - ndarray - GeeksforGeeks
July 26, 2025 - ndarray is a short form for N-dimensional array which is a important component of NumPy. It’s allows us to store and manipulate large amounts of data efficiently. All elements in an ndarray must be of same type making it a homogeneous array.
🌐
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.
🌐
CodingNomads
codingnomads.com › arrays-in-numpy-ndarray
Arrays in NumPy: ndarray, np.empty, np.arange, np.linspace
The NumPy ndarray is a multidimensional array of elements all of the same type. 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 Python Coding Stack
thepythoncodingstack.com › the python coding stack › why can't i just use a list? • understanding numpy's `ndarray` (a numpy for numpties article)
Why Can't I Just Use A List? • Understanding NumPy's `ndarray` (A NumPy for Numpties article)
June 25, 2024 - You can also do this with NumPy ndarray objects. However, as you'll see later, you often won't want to use an ndarray in a for loop. But I'm sprinting ahead again. Lists are mutable. You can add, remove or replace items in a list without creating a new list. NumPy arrays are also mutable types.
🌐
Codemia
codemia.io › home › knowledge hub › what is the difference between ndarray and array in numpy?
What is the difference between ndarray and array in NumPy? | Codemia
September 23, 2025 - These are different types with different goals. The standard-library array.array is a compact one-dimensional container. NumPy's ndarray supports multidimensional data and numerical operations that the standard library type does not.
🌐
Reddit
reddit.com › r/rust › rust ndarray vs. python numpy performance?
r/rust on Reddit: Rust ndarray vs. Python NumPy Performance?
April 17, 2019 -

I am currently taking a machine learning course at the university that I attend, and it seems like an overwhelming majority of the class is using Python.

I decided to implement our first project in Rust, because I love Rust, and I have been really happy with the results using the ndarray crate. I've never used Python, though it seems like a clear winner in the machine-learning community.

After a quick google search, I can't find any comparisons on the performance of ndarray vs numpy.

I do see a nice document comparing the APIs: https://docs.rs/ndarray/0.12.1/ndarray/doc/ndarray_for_numpy_users/index.html

Does anyone have any experience with both?

Top answer
1 of 7
43

I am very curious in what you find out. Although if you are interested in pursuing machine learning at all, you should do these projects in Python (even if you do them in Rust first). The entire ML industry is very heavily geared around Python, and ML teams are unlikely to know Rust. Often they are more math focused and less comfortable with programming syntax in general, so anything that eases communication friction is advisable.

That said, I am very interested in how well Rust handles common tasks that I might do with NumPy. I was just pondering porting a noise-based image generation Python script that uses NumPy over to Rust.

2 of 7
29

There are two standards for math API libraries – BLAS and Lapack. Between them these are to maths what OpenGL is to graphics.

Vendors make their own compatible implementations of these library APIs: Intel has the MKL, and even NVidia has CuBLAS.

There are also many open-source implementations, like GotoBLAS and Atlas.

Numpy wraps whichever BLAS library it finds on your machine. The features it offers are fairly bare-bones. As soon as you get into any decent sort of math – machine learning in my case – you need some of the features in Lapack which Scipy wraps and (significantly) augments.

I would expect Numpy to be as fast or faster than ndarry. Some of the BLAS implementations it wraps like GotoBLAS are super-mature and optimised, with chunks of handcrafted assembly.

Ndarray it seems has experimental support to delegate to native BLAS which may help.

For your purposes, you need to consider what your project needs to deliver. If it is a novel implementation of an existing machine-learning method, then Rust is great. If it is a broader project that uses machine learning tools, choosing Python maximises your chances of success.

🌐
NumPy
numpy.org › devdocs › reference › arrays.html
Array objects — NumPy v2.6.dev0 Manual
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of “items” of the same type.
🌐
NumPy
numpy.org › doc › stable › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.5 Manual
A three-dimensional array would be like a set of tables, perhaps stacked as though they were printed on separate pages. In NumPy, this idea is generalized to an arbitrary number of dimensions, and so the fundamental array class is called ndarray: it represents an “N-dimensional array”.
🌐
NumPy
numpy.org › doc › stable › reference › arrays.html
Array objects — NumPy v2.5 Manual
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of “items” of the same type.
🌐
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.
🌐
NumPy
numpy.org › devdocs › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.6.dev0 Manual
A three-dimensional array would be like a set of tables, perhaps stacked as though they were printed on separate pages. In NumPy, this idea is generalized to an arbitrary number of dimensions, and so the fundamental array class is called ndarray: it represents an “N-dimensional array”.
Top answer
1 of 2
2

There's no difference; they're identical.

numpy.ndarray is the actual type of numpy arrays; <class 'numpy.ndarray'> is the string represention ot numpy.ndarray:

>>> import numpy as np
>>> a = np.array([1, 2, 3])
array([1, 2, 3])

>>> print(type(a) == np.ndarray)
True

>>> np.ndarray
<class 'numpy.ndarray'>

>>> print(type(a))
<class 'numpy.ndarray'>

>>> str(type(a))
"<class 'numpy.ndarray'>"

>>> repr(type(a))
"<class 'numpy.ndarray'>"

Python interpreters such as IPython and Jupyter (which underneath are actually the same thing) will trim of the <class '...' > part and only show the type itself when you enter the type the into interpreter, e.g. ipython:

$ ipython
Python 3.9.9 (main, Nov 21 2021, 03:23:44) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import numpy as np

In [2]: np.ndarray
Out[2]: numpy.ndarray

...versus python (the builtin interpreter):

$ python3
Python 3.9.9 (main, Nov 21 2021, 03:23:44) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.ndarray
<class 'numpy.ndarray'>

...but they're the exact same type.

2 of 2
1

I wonder if you are confusing numpy arrays and python lists. I/we often talk about a numpy array, meaning actually an object of class/type np.ndarray.

In [144]: a = [1, 2, 3]         # a list
In [145]: b = np.array(a)       # an array
In [146]: type(a), type(b)
Out[146]: (list, numpy.ndarray)

Your expression works with the array, but not the list:

In [147]: (b == 1).sum()
Out[147]: 1
In [148]: (a == 1).sum()
Traceback (most recent call last):
  Input In [148] in <module>
    (a == 1).sum()
AttributeError: 'bool' object has no attribute 'sum'

In [149]: b == 1
Out[149]: array([ True, False, False])
In [150]: a == 1
Out[150]: False

Note that I created b with np.array(). There is a np.ndarray function, but we don't usually use it - it's a low level creator that most of us don't need. A useful starting page:

https://numpy.org/doc/1.22/user/basics.creation.html

🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.ndarray.html
numpy.ndarray — NumPy v2.3 Manual
Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array.
🌐
NumPy
numpy.org › doc › 2.2 › reference › arrays.ndarray.html
The N-dimensional array (ndarray) — NumPy v2.2 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.