pyspark.pandas.MultiIndex.equal_levels

MultiIndex.equal_levels(other: pyspark.pandas.indexes.multi.MultiIndex) → bool[source]

Return True if the levels of both MultiIndex objects are the same

New in version 3.3.0.

Examples

>>> psmidx1 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
>>> psmidx2 = ps.MultiIndex.from_tuples([("b", "y"), ("a", "x"), ("c", "z")])
>>> psmidx1.equal_levels(psmidx2)
True
>>> psmidx2 = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "j")])
>>> psmidx1.equal_levels(psmidx2)
False