[英]Differences between python's numpy.ndarray and list datatypes
What are the differences between python's numpy.ndarray and list datatypes? python的numpy.ndarray和list数据类型有什么区别? I have vague ideas, but would like to get a definitive answer about: 我有一些模糊的想法,但想得到一个明确的答案:
Thanks! 谢谢!
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). 当我需要进行一些数学运算(求和,平均,数组乘法等)时,我更喜欢使用numpy数组,当我需要迭代'items'(字符串,文件等)时,我更喜欢使用numpy数组。
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. 使用numpy数组的主要好处应该是更小的内存消耗和更好的运行时行为。
One of the main advantages of NumPy is its advantage in time compared to standard Python. 与标准Python相比,NumPy的主要优势之一是其优势。
Good Explanation : https://www.python-course.eu/numpy.php 好的解释: https : //www.python-course.eu/numpy.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.