larray.Axis.index

Axis.index(self, key)[source]

Translates a label key to its numerical index counterpart.

Parameters
keykey

Everything usable as a key.

Returns
(array of) int

Numerical index(ices) of (all) label(s) represented by the key

Notes

Fancy index with boolean vectors are passed through unmodified

Examples

>>> people = Axis(['John Doe', 'Bruce Wayne', 'Bruce Willis', 'Waldo', 'Arthur Dent', 'Harvey Dent'], 'people')
>>> people.index('Waldo')
3
>>> people.index(people.containing('Bruce'))
array([1, 2])