larray.Axis.intersection

Axis.intersection(self, other)[source]

Returns 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. Labels relative order will be kept intact.

Parameters:
other : Axis 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')