Differences between python numpy.ndarray types and type lists

What are the differences between python numpy.ndarray types and type lists? I have vague ideas, but would like to get a definitive answer about:

  • Size in memory
  • Speed ​​/ Access Order
  • Speed ​​/ order of modification in place but retaining length
  • The effect of length changes

Thank!

+3
source share
1 answer

There are several differences:

  • You can add items to the list, but you cannot resize 'numpy.ndarray' without a full copy.
  • Lists can contain everything; in numpy arrays, all elements must be of the same type.
  • In practice, numpy arrays are faster for vector functions than mapping functions to lists.
  • , , .
  • Numpy ('argmin ','min', aort', ..).

numpy, (, , ..) , "" (, ..).

+4

All Articles