首页 > 解决方案 > 使用 IQR 删除异常值会给出错误“对象类型系列没有名为 1 的轴”

问题描述

在使用 IQR 从列中删除异常值时,它向我显示错误 - 'No axis named 1 for object type Series'

df = df[~((df['DISTANCE_FROM_HOME'] < (q1 - 1.5 * iqr)) 
          |(df['DISTANCE_FROM_HOME'] > (q3 + 1.5 * iqr))
          ).any(axis=1)]

标签: pythonpandas

解决方案


推荐阅读