larray.AxisCollection.get_by_pos

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

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

Parameters:
key : key

Key corresponding to an axis.

i : int

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')