pandas 1.4.2

ParametersReturns
equals(self, other: 'Any') -> 'bool'

The things that are being compared are:

Parameters

other : Any

The other object to compare against.

Returns

bool

True if "other" is an Index and it has the same elements and order as the calling index; False otherwise.

Determine if two Index object are equal.

Examples

This example is valid syntax, but we were not able to check execution
>>> idx1 = pd.Index([1, 2, 3])
... idx1 Int64Index([1, 2, 3], dtype='int64')
This example is valid syntax, but we were not able to check execution
>>> idx1.equals(pd.Index([1, 2, 3]))
True

The elements inside are compared

This example is valid syntax, but we were not able to check execution
>>> idx2 = pd.Index(["1", "2", "3"])
... idx2 Index(['1', '2', '3'], dtype='object')
This example is valid syntax, but we were not able to check execution
>>> idx1.equals(idx2)
False

The order is compared

This example is valid syntax, but we were not able to check execution
>>> ascending_idx = pd.Index([1, 2, 3])
... ascending_idx Int64Index([1, 2, 3], dtype='int64')
This example is valid syntax, but we were not able to check execution
>>> descending_idx = pd.Index([3, 2, 1])
... descending_idx Int64Index([3, 2, 1], dtype='int64')
This example is valid syntax, but we were not able to check execution
>>> ascending_idx.equals(descending_idx)
False

The dtype is not compared

This example is valid syntax, but we were not able to check execution
>>> int64_idx = pd.Int64Index([1, 2, 3])
... int64_idx Int64Index([1, 2, 3], dtype='int64')
This example is valid syntax, but we were not able to check execution
>>> uint64_idx = pd.UInt64Index([1, 2, 3])
... uint64_idx UInt64Index([1, 2, 3], dtype='uint64')
This example is valid syntax, but we were not able to check execution
>>> int64_idx.equals(uint64_idx)
True
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/base.py#5178
type: <class 'function'>
Commit: