xarray.CFTimeIndex.identical#

CFTimeIndex.identical(other)[source]#

Similar to equals, but checks that object attributes and types are also equal.

While Index.equals() only checks that the elements are the same, this method additionally verifies that the Index objects have matching types and attributes (e.g., name).

Parameters:

other (Index) – The Index object you want to compare with the current Index object.

Returns:

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

See also

Index.equals

Determine if two Index object are equal.

Index.has_duplicates

Check if the Index has duplicate values.

Index.is_unique

Return if the index has unique values.

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