[Numpy-discussion] Extracting required indices from the array of tuples
Simen Langseth
simlangen at gmail.com
Fri Jan 2 06:06:09 EST 2015
import numpy as np
from scipy import signal
y = np.array([[2, 1, 2, 3, 2, 0, 1, 0],
[2, 1, 2, 3, 2, 0, 1, 0]])
maximas = signal.argrelmax(y, axis=1)
print maximas
(array([0, 0, 1, 1], dtype=int64), array([3, 6, 3, 6], dtype=int64))
I want to extract only the first maxima of both rows, i.e., [3, 3] using
the tuples (maximas). How would you do it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150102/66c4a862/attachment.html>
More information about the NumPy-Discussion
mailing list