Return 所有被视为离群值的行

Return all rows that are considered outliers

我的 df 有这个结构 -

id  client     Calls
153 2409        1.0
154 2410        2.0
155 2690        2.0
156 2210        3.0
157 2460        41.0

我正在使用以下代码来计算异常值 -

outliers = [y for stat in boxplot_stats(df['Calls']) for y in stat['fliers']]

那个的输出是

id     calls
1      41.0

如何从 df 中获取 return 实际行。例如-

    id  client      calls
    157 2460        41.0

因为我们不知道什么是stat,我只能根据你的outliers使用isin

得到你需要的
yourdf=df[df.Calls.isin(outliers.calls)]