larray.Axis.index
- Axis.index(key) Union[int, ndarray, slice] [source]
Translate a label key to its numerical index counterpart.
- Parameters
- keykey
Everything usable as a key.
- Returns
- int, slice, np.ndarray or Arrray
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])