larray.AxisCollection.axis_id

AxisCollection.axis_id(axis) Union[str, int][source]

Return the id of an axis.

Returns
str or int

Id of axis, which is its name if defined and its position otherwise.

Examples

>>> a = Axis(2, 'a')
>>> b = Axis(2)
>>> c = Axis(2, 'c')
>>> col = AxisCollection([a, b, c])
>>> col.axis_id(a)
'a'
>>> col.axis_id(b)
1
>>> col.axis_id(c)
'c'