Whats the easiest way to set a ceiling to column values in a DataFrame

Hi how’s it going?

I want to set a ceiling value to a column in my dataframe so that every value greater than 1.0 is equal to 1.0, everything else remains untouched.

What’s the easiest way to do this?

The function clamp will do this.

julia> x = randn(1000);

julia> clamp.(x, -Inf, 1)

There is also a modifying clamp! that modifies the vector.

3 Likes

thank you!