Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PREVIOUS NEXT
Code Example
Python :: how to change index date format pandas 
Python :: how to capitalize first letter in python 
Python :: Python NumPy split Function Example 
Python :: display array of odd rows and even columns in numpy 
Python :: python - count total numeber of row in a dataframe 
Python :: pandas remove leading trailing spaces in dataframe 
Python :: seconds to datetime.time 
Python :: c++ vs python 
Python :: how to run python program in sublime text 3 windows 
Python :: cheat sheet python 
Python :: how to colour letters in python 
Python :: python 3d array 
Python :: remove new line character from string python 
Python :: pyplot savefig 
Python :: vscode set python identation to four 
Python :: redirect a post request django 
Python :: sqlalchemy filter between dates 
Python :: start project django 
Python :: how to show a frequency distribution based on date in python 
Python :: python tkinter arabic 
Python :: extract email address using expression in django 
Python :: python functions with input 
Python :: How to remove all characters after a specific character in python? 
Python :: Cast image to float32 
Python :: django or 
Python :: django-sslserver 
Python :: how to convert python input to int 
Python :: notna pandas 
Python :: how to get the link of an image in selenium python 
Python :: get last 3 things in a list python 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =