A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/dev/user_guide/../reference/api/pandas.Index.get_loc.html below:

pandas.Index.get_loc — pandas 3.0.0.dev0+2231.g4f2aa4d2be documentation

pandas.Index.get_loc#
Index.get_loc(key)[source]#

Get integer location, slice or boolean mask for requested label.

Parameters:
keylabel

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

Returns:
int if unique index, slice if monotonic index, else mask

Integer location, slice or boolean mask.

See also

Index.get_slice_bound

Calculate slice bound that corresponds to given label.

Index.get_indexer

Computes indexer and mask for new index given the current index.

Index.get_non_unique

Returns indexer and masks for new index given the current index.

Index.get_indexer_for

Returns an indexer even when non-unique.

Examples

>>> unique_index = pd.Index(list("abc"))
>>> unique_index.get_loc("b")
1
>>> monotonic_index = pd.Index(list("abbc"))
>>> monotonic_index.get_loc("b")
slice(1, 3, None)
>>> non_monotonic_index = pd.Index(list("abcb"))
>>> non_monotonic_index.get_loc("b")
array([False,  True, False,  True])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4