arraysnumpyelementmagnitude

How can I find the biggest magnitude present in a numpy array?


Say I have:

A = np.array( [1,2,3,-8] )

I need a function that would return 8

I know it's a simple one, but instant Google-Fu failed, hence some merit in populating SO maybe.


Solution

  • You can try running :

     np.abs(A).max()