0

I am working on some stuff where I use numpy a lot. In many cases it's possible to use build-in operations for numpy arrays. I have various questions regarding efficiency and coding style.

I have noticed that for many operations regarding the shape of an array it's much faster to firstly convert to a list, do the operation and reconvert. But my actual question is going in a slightly different direction.

Let's say we have a 1dim. numpy array x and we want to find out some information like minimum, maximum, amount of values, etc. Should we use numpy's functions like np.amax, np.amin, x.size, ... or use python's build-in functions like max,min, len, ...?

famfop
  • 185
  • 1
  • 1
  • 9
  • If your NumPy arrays are relatively large and of some non-object dtype (e.g. float64, int32, ...), it will be faster to use NumPy's functions/methods for finding the maximum, summing, and so on. As the question stands, there's not enough information to give a specific answer. – Alex Riley May 24 '16 at 10:15
  • Thanks for your time but the linked page helped me to test it on my own functions, therefore solving my question. :) – famfop May 24 '16 at 10:28

0 Answers0