larray.Axis.index¶
-
Axis.index(key, bool_passthrough=True)[source]¶ Translates a label key to its numerical index counterpart.
Parameters: key : key
Everything usable as a key.
bool_passthrough : bool, optional
If set to True and key is a boolean vector, it is returned as it.
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.matching('Bruce')) array([1, 2])