Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 757
P i Avatar asked Feb 02 '26 18:02

P i


1 Answers

You can try running :

 np.abs(A).max()
like image 55
F.X. Avatar answered Feb 05 '26 10:02

F.X.