larray.Axis.subaxis

Axis.subaxis(key, name=None)[source]

Returns an axis for a sub-array.

Parameters:

key : int, or collection (list, slice, array, LArray) of them

Position(s) of labels to use for the new axis.

name : str, optional

Name of the subaxis. Defaults to the name of the parent axis.

Returns:

Axis

Subaxis. If key is a None slice and name is None, the original Axis is returned. If key is a LArray, the list of axes is returned.

Examples

>>> age = Axis(range(100), 'age')
>>> age.subaxis(range(10, 19), 'teenagers')
Axis([10, 11, 12, 13, 14, 15, 16, 17, 18], 'teenagers')