Answers for "replace outliers with nan python"

0

replace outliers with nan python

df.mask(df.sub(df.mean()).div(df.std()).abs().gt(2))

    c1   c2  c3 
0  NaN  1.0  2.0
1  1.0  3.0  4.0
2  2.0  5.0  6.0
3  3.0  1.0  NaN
4  4.0  3.0  4.0
5  5.0  5.0  6.0
6  6.0  NaN  6.0
Posted by: Guest on April-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language