larray.Axis.split

Axis.split(sep='_', names=None, regex=None, return_labels=False) Union[List[Axis], Tuple[List[Axis], Tuple[Group]]][source]

Split axis and returns a list of Axis.

Parameters
sepstr, optional

Delimiter to use for splitting. Defaults to ‘_’. When regex is provided, the delimiter is only used on names if given as one string or on axis name if names is None.

namesstr or list of str, optional

Names of resulting axes. Defaults to None.

regexstr, optional

Use regex instead of delimiter to split labels. Defaults to None.

return_labelsbool, optional

Whether split labels must be returned (as a tuple of tuples). These labels are suitable for indexing via array.points[labels]. Defaults to False.

Returns
list of Axis or (list of Axis, array-like)

Examples

>>> a_b = Axis('a_b=a0_b0,a0_b1,a0_b2,a1_b0,a1_b1,a1_b2')
>>> a_b.split()
[Axis(['a0', 'a1'], 'a'), Axis(['b0', 'b1', 'b2'], 'b')]
>>> ab = Axis('ab=a0_b0,a0_b1')
>>> ab.split(names=["a", "b"])
[Axis(['a0'], 'a'), Axis(['b0', 'b1'], 'b')]