Arrays vs NumPy Arrays vs List
2 min readJul 22, 2024
On learning NumPy lots of confusion arises between Python array, NumPy (ndarray) and List.
Let’s check the difference between array, ndarray and list, shown below
Python Array/ array:
NumPy Array/ ndarray:
List:
Below examples shows the difference:
First Example:
Second Example:
Conclusion:
- 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 efficient for numerical operations.
- Python Array (from array module): More memory-efficient than lists for homogeneous data, with limited functionality compared to NumPy arrays.
That’s it for now, let’s deep dive into NumPy in my upcoming blogs.
And can learn more from my Github profile:
Also Matplotlib learnings from github:
Pandas Learnings from github:
Check some of my other blogs in this series: