larray.Axis.intersection

Axis.intersection(other) Axis[source]

Return axis with the (set) intersection of this axis labels and other labels.

In other words, this will use labels from this axis if they are also in other. Duplicate labels and labels relative order will be kept intact.

Parameters:
otherAxis, Group or any sequence of labels

other labels

Returns:
Axis

Examples

>>> a = Axis('a=a0..a2')
>>> a.intersection('a1')
Axis(['a1'], 'a')
>>> a.intersection('a3')
Axis([], 'a')
>>> a.intersection(Axis('a=a1..a3'))
Axis(['a1', 'a2'], 'a')
>>> a.intersection('a1..a3')
Axis(['a1', 'a2'], 'a')
>>> a.intersection(['a1', 'a2', 'a3'])
Axis(['a1', 'a2'], 'a')
>>> Axis('a=a0,a1,a0').intersection('a1,a0')
Axis(['a0', 'a1', 'a0'], 'a')