larray.AxisCollection.pop

AxisCollection.pop(axis=-1) Axis[source]

Remove and return an axis.

Parameters
axiskey, optional

Axis to remove and return. Default value is -1 (last axis).

Returns
Axis

If no argument is provided, the last axis is removed and returned.

Examples

>>> age = Axis(range(20), 'age')
>>> sex = Axis('sex=M,F')
>>> time = Axis([2007, 2008, 2009, 2010], 'time')
>>> col = AxisCollection([age, sex, time])
>>> col.pop('age')
Axis([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], 'age')
>>> col
AxisCollection([
    Axis(['M', 'F'], 'sex'),
    Axis([2007, 2008, 2009, 2010], 'time')
])
>>> col.pop()
Axis([2007, 2008, 2009, 2010], 'time')