index of an element in a numarray array

rory.brandybuck at gmail.com rory.brandybuck at gmail.com
Fri May 12 08:33:17 EDT 2006


avharut at gmail.com wrote:
> how can i find in an efficient way the index of the last occurrence of
> a given element in a numarray array?

Something like that:
>>> where(arange(100) == 10)
(array([10]),)
>>> _[-1][-1]
10

Or:
>>> your_array = arange(10)
>>> value = 3
>>> indices = where(your_array == value)
>>> last_index = indices[0][-1]
>>> print last_index




More information about the Python-list mailing list