A RetroSearch Logo

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

Search Query:

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

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

pandas.Index.where#
final Index.where(cond, other=None)[source]#

Replace values where the condition is False.

The replacement is taken from other.

Parameters:
condbool array-like with the same length as self

Condition to select the values on.

otherscalar, or array-like, default None

Replacement if the condition is False.

Returns:
pandas.Index

A copy of self with values replaced from other where the condition is False.

Examples

>>> idx = pd.Index(["car", "bike", "train", "tractor"])
>>> idx
Index(['car', 'bike', 'train', 'tractor'], dtype='object')
>>> idx.where(idx.isin(["car", "train"]), "other")
Index(['car', 'other', 'train', 'other'], dtype='object')

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