pyspark.pandas.MultiIndex.identical#

MultiIndex.identical(other)#

Similar to equals, but check that other comparable attributes are also equal.

Returns
bool

If two Index objects have equal elements and same type True, otherwise False.

Examples

>>> from pyspark.pandas.config import option_context
>>> idx = ps.Index(['a', 'b', 'c'])
>>> midx = ps.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])

For Index

>>> idx.identical(idx)
True
>>> with option_context('compute.ops_on_diff_frames', True):
...     idx.identical(ps.Index(['a', 'b', 'c']))
True
>>> with option_context('compute.ops_on_diff_frames', True):
...     idx.identical(ps.Index(['b', 'b', 'a']))
False
>>> idx.identical(midx)
False

For MultiIndex

>>> midx.identical(midx)
True
>>> with option_context('compute.ops_on_diff_frames', True):
...     midx.identical(ps.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')]))
True
>>> with option_context('compute.ops_on_diff_frames', True):
...     midx.identical(ps.MultiIndex.from_tuples([('c', 'z'), ('b', 'y'), ('a', 'x')]))
False
>>> midx.identical(idx)
False