Reputation: 49
What are the differences between python's numpy.ndarray and list datatypes? I have vague ideas, but would like to get a definitive answer about:
Thanks!
Upvotes: 4
Views: 6507
Reputation: 339
I read from various links and resources and summarize my understanding as below:
The main benefits of using numpy arrays should be smaller memory consumption and better runtime behavior.
One of the main advantages of NumPy is its advantage in time compared to standard Python.
Good Explanation : https://www.python-course.eu/numpy.php
Upvotes: 1
Reputation: 8264
There are several differences:
I prefer to use numpy arrays when I need to do some mathematical operations (sum, average, array multiplication, etc) and list when I need to iterate in 'items' (strings, files, etc).
Upvotes: 6