pandas.Index.identical#

final Index.identical(other)[源代码]#

类似于 equals,但会检查对象属性和类型是否也相等。

Returns:
bool

如果两个 Index 对象具有相等的元素和相同的类型,则为 True,否则为 False。

Examples

>>> idx1 = pd.Index(['1', '2', '3'])
>>> idx2 = pd.Index(['1', '2', '3'])
>>> idx2.identical(idx1)
True
>>> idx1 = pd.Index(['1', '2', '3'], name="A")
>>> idx2 = pd.Index(['1', '2', '3'], name="B")
>>> idx2.identical(idx1)
False