pandas 1.4.2

ParametersRaisesReturns
__contains__(self, key: 'Any') -> 'bool'

Parameters

key : label

The key to check if it is present in the index.

Raises

TypeError

If the key is not hashable.

Returns

bool

Whether the key search is in the index.

Return a boolean indicating whether the provided key is in the index.

See Also

Index.isin

Returns an ndarray of boolean dtype indicating whether the list-like key is in the index.

Examples

This example is valid syntax, but we were not able to check execution
>>> idx = pd.Index([1, 2, 3, 4])
... idx Int64Index([1, 2, 3, 4], dtype='int64')
This example is valid syntax, but we were not able to check execution
>>> 2 in idx
True
This example is valid syntax, but we were not able to check execution
>>> 6 in idx
False
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/category.py#379
type: <class 'function'>
Commit: