pandas.Index.putmask#

Index.putmask(mask, value)[source]#

Return a new Index of the values set with the mask.

Returns:
Index

See also

numpy.ndarray.putmask

Changes elements of an array based on conditional and input values.

Examples

>>> idx1 = pd.Index([1, 2, 3])
>>> idx2 = pd.Index([5, 6, 7])
>>> idx1.putmask([True, False, False], idx2)
Index([5, 2, 3], dtype='int64')