[Tutor] finding a maximum between the absolute difference of several columns

Peter Otten __peter__ at web.de
Fri Feb 17 13:03:36 CET 2012


Andre' Walker-Loud wrote:

> import numpy as np
> Vhel_fdiff3 = np.array([abs(Vmatch3_1 - Vmatch3_2), abs(Vmatch3_1 -
> Vmatch3_3), abs(Vmatch3_3 - Vmatch3_2)])
> your_answer = Vhel_fdiff3.max(axis=0)

or

import numpy as np
a = np.array([Vmatch3_1-Vmatch3_2, Vmatch3_1-Vmatch3_3, Vmatch3_3-
Vmatch3_2])
print np.max(np.abs(a), axis=0)




More information about the Tutor mailing list