[Tutor] finding a maximum between the absolute difference of several columns
Andre' Walker-Loud
walksloud at gmail.com
Fri Feb 17 18:29:07 CET 2012
> 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)
yes, this one is better than mine. It is more flexible, leaving more options for what you may want to do with it afterwards,
andre
More information about the Tutor
mailing list