【发布时间】:2020-07-06 03:22:53
【问题描述】:
我正在从列中查找异常值并将它们存储在列表中。现在我想删除所有的值 列在我的列表中。 怎样才能做到这一点?
这是我查找异常值的函数
outlier=[]
def detect_outliers(data):
threshold=3
m = np.mean(data)
st = np.std(data)
for i in data:
#calculating z-score value
z_score=(i-m)/st
#if the z_score value is greater than threshold value than its a outlier
if np.abs(z_score)>threshold:
outlier.append(i)
return outlier
This is my column in data frame
df_train_11.AMT_INCOME_TOTAL
【问题讨论】:
标签: pandas numpy machine-learning scikit-learn