larray.AxisCollection.get_by_pos

AxisCollection.get_by_pos(key, i) Axis[source]

Return axis corresponding to a key, or to position i if the key has no name and key object not found.

Parameters
keykey

Key corresponding to an axis.

iint

Position of the axis (used only if search by key failed).

Returns
Axis

Axis corresponding to the key or the position i.

Examples

>>> age = Axis(range(20), 'age')
>>> sex = Axis('sex=M,F')
>>> time = Axis([2007, 2008, 2009, 2010], 'time')
>>> col = AxisCollection([age, sex, time])
>>> col.get_by_pos('sex', 1)
Axis(['M', 'F'], 'sex')