The expression `clip` is pretty straightforward:

You provide a lower and an upper bound, and Polars makes sure all values fall within those bounds.

If a value is too small/too large, it's replaced by the bound.

Bounds can be literals, other columns, or arbitrary expressions.
Post image

Comments