pyspark.pandas.MultiIndex.intersection#

MultiIndex.intersection(other)[source]#

Form the intersection of two Index objects.

This returns a new Index with elements common to the index and other.

Parameters
otherIndex or array-like
Returns
intersectionMultiIndex

Examples

>>> midx1 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
>>> midx2 = ps.MultiIndex.from_tuples([("c", "z"), ("d", "w")])
>>> midx1.intersection(midx2).sort_values()  
MultiIndex([('c', 'z')],
           )