pandas.Index.putmask
pandas 3.1.1 · Index objects · method
Build an index with replacements wherever the supplied boolean mask is true.
Call syntax
Index.putmask(mask, value)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
mask |
Required Positional or keyword |
array-like of bool Provide boolean positions where replacements should be applied. |
value |
Required Positional or keyword |
scalar Provide the value used for the documented operation, such as a replacement or a test point. |
Returns
Index