python
remove outliers
def outliers(column):
Q1, Q3 = np.percentile(column, [25, 75])
IQR = Q3 - Q1
lower_range = Q1 - (1.5 * IQR)
upper_range = Q3 + (1.5 * IQR)
return lower_range, upper_range
outliers(df['yearly_salary'])
Output
(-2750.0, 151250.0)
# remove outliers from a single column
Was this helpful?
Similar Posts
- Python - regex , remove all single characters,replace all single chars,char
- Python - String ,remove,delete,replace,extract numbers from string
- Pandas - Delete,Remove,Drop, column from pandas DataFrame
- Remove a key from a dictionary Python
- Trim or remove begin and end spaces from a python string
- Python code to remove falsy values(None, False, [], {}, etc)
- Remove an item from python list using its index