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
🌐
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.
🌐
SciPython
scipython.com › books › book2 › chapter-6-numpy › questions › npndarray-and-nparray
Q6.1.1: np.ndarray and np.array
Learning Scientific Programming with Python (2nd edition) 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.
🌐
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. So when someone writes "array," context matters.
🌐
Planet of Bits
planetofbits.com › home › difference between ndarray and array in numpy
Difference between ndarray and array in numpy - Planet of Bits
July 24, 2018 - numpy.array() is just a method which returns an array object of the type ndarray. Since the name of the method is array, developers who are new to Python often tend to confuse that numpy.array returns an array object of some “array” type.
🌐
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.
🌐
Iditect
iditect.com › faq › python › what-is-the-difference-between-ndarray-and-array-in-numpy.html
What is the difference between ndarray and array in NumPy?
In NumPy, both ndarray (short for "n-dimensional array") and array are used to represent arrays, but they are essentially the same thing. The term array is commonly used to refer to NumPy arrays, and ndarray is just an alias for array.
🌐
pythontutorials
pythontutorials.net › blog › what-is-the-difference-between-ndarray-and-array-in-numpy
NumPy ndarray vs array: What's the Difference? Plus Source Code Implementation — pythontutorials.net
Both ndarray and array.array are more memory-efficient than Python lists (which store pointers to objects). However: array.array is lighter for small, 1D datasets with primitive types (e.g., storing a list of integers) due to minimal metadata. ...
Find elsewhere
🌐
Towards Data Science
towardsdatascience.com › home › latest › 6 key differences between np.ndarray and np.matrix objects
6 Key differences between np.ndarray and np.matrix objects | Towards Data Science
January 22, 2025 - If you need to work on multi-dimensional arrays, you should use the ndarray objects as they are multi-dimensional. Numpy documentation recommends you using ndarray objects instead of matrix objects.
Top answer
1 of 4
8

NumPy and Python arrays share the property of being efficiently stored in memory.

NumPy arrays can be added together, multiplied by a number, you can calculate, say, the sine of all their values in one function call, etc. As HYRY pointed out, they can also have more than one dimension. You cannot do this with Python arrays.

On the other hand, Python arrays can indeed be appended to. Note that NumPy arrays can however be concatenated together (hstack(), vstack(),…). That said, NumPy arrays are mostly meant to have a fixed number of elements.

It is common to first build a list (or a Python array) of values iteratively and then convert it to a NumPy array (with numpy.array(), or, more efficiently, with numpy.frombuffer(), as HYRY mentioned): this allows mathematical operations on arrays (or matrices) to be performed very conveniently (simple syntax for complex operations). Alternatively, numpy.fromiter() might be used to construct the array from an iterator. Or loadtxt() to construct it from a text file.

2 of 4
7

There are at least two main reasons for using NumPy arrays:

  • NumPy arrays require less space than Python lists. So you can deal with more data in a NumPy array (in-memory) than you can with Python lists.
  • NumPy arrays have a vast library of functions and methods unavailable to Python lists or Python arrays.

Yes, you can not simply convert lists to NumPy arrays and expect your code to continue to work. The methods are different, the bool semantics are different. For the best performance, even the algorithm may need to change.

However, if you are looking for a Python replacement for Matlab, you will definitely find uses for NumPy. It is worth learning.

🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › numpy › difference-between-numpy-array-and-numpy-matrix
Difference between Numpy array and Numpy matrix - GeeksforGeeks
July 23, 2025 - While working with Python many times we come across the question that what exactly is the difference between a numpy array and numpy matrix, in this article we are going to read about the same. The Numpy array object in Numpy is called ndarray. We ...
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 › stable › reference › generated › numpy.ndarray.html
numpy.ndarray — NumPy v2.5 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.
🌐
GeeksforGeeks
geeksforgeeks.org › numpy › difference-between-np-asarray-and-np-array
Difference between np.asarray() and np.array()? - GeeksforGeeks
July 23, 2025 - The np.array() in Python is used to convert a list, tuple, etc. into a Numpy array. ... Return : [ndarray] Array interpretation of arr.
🌐
CodingNomads
codingnomads.com › arrays-in-numpy-ndarray
Arrays in NumPy: ndarray, np.empty, np.arange, np.linspace
NumPy's main data structure is the ndarray (n-dimensional array), which stores elements of the same data type (dtype) in a homogeneous way. The dtype determines the type of elements (e.g., int64, float64) and is the same for all elements in ...
🌐
TutorialsPoint
tutorialspoint.com › numpy › numpy_ndarray_object.htm
NumPy - Ndarray Object
The following diagram shows a ... can be constructed by different array creation routines. The basic ndarray is created using the array() function in NumPy....
🌐
NumPy
numpy.org › doc › 2.4 › reference › arrays.html
Array objects — NumPy v2.4 Manual
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of “items” of the same type.
🌐
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.