← Back to roadmap
where / mask
Conditional value selection and replacement — mirrors pandas.Series.where and pandas.DataFrame.mask.
1 — whereSeries: keep values where condition is true
whereSeries(series, cond) keeps each element where cond is true and replaces it with null (or a custom other) where cond is false.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
2 — maskSeries: replace values where condition is true
maskSeries is the inverse of whereSeries: it replaces where cond is true and keeps where cond is false.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
3 — Boolean Series as condition
Pass a Series<boolean> (or a plain boolean array) as the condition for position-aligned filtering.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
4 — whereDataFrame: cell-wise filtering on a DataFrame
whereDataFrame(df, cond) applies the condition independently to each cell across all columns.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
5 — maskDataFrame: replace cells matching condition
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
6 — DataFrame condition (boolean DataFrame)
Pass a boolean DataFrame as the condition for per-cell control.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
7 — Combining where and mask for range clamping
Chaining whereSeries and maskSeries is a clean way to apply lower and upper bounds.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
8 — where / mask vs. clip
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent