## Question:

I have a dataframe:*std and mean-3*std. In other words, values less than mean-3

*std, and values higher than mean+3*std, should be replaced by np.nan.

I am just putting one column of my dataframe, but I actually have eleven columns where all values outside the specific column range must be replaced by np.nan. All in place within the original df.

Is there a simple way of doing this? I have tried to use lambda functions with where, but it doesn’t work.

## Answer:

Use`DataFrame.mask`

If you have better answer, please add a comment about this, thank you!