larray.IGroup.intersection

IGroup.intersection(self, other)

Returns (set) intersection of this label group and other.

In other words, this will return labels from this group which are also in other. Labels relative order will be kept intact, but only unique labels will be returned.

Parameters:
other : Group or any sequence of labels

other labels

Returns:
LSet

Examples

>>> from larray import Axis
>>> a = Axis('a=a0..a2')
>>> a['a0', 'a1'].intersection(a['a1', 'a2'])
a['a1'].set()
>>> a['a0', 'a1'].intersection('a1,a2')
a['a1'].set()
>>> a['a0', 'a1'].intersection(['a1', 'a2'])
a['a1'].set()