【发布时间】:2020-06-24 07:20:12
【问题描述】:
下面显示的代码只是我正在工作的一个大项目的一个sn-p。
O = stats.scoreatpercentile(dfx[dfx['outlier'] == 1]['column_name'], np.abs(threshold))
l = stats.scoreatpercentile(dfx[dfx['outlier'] == 0]['column_name'], np.abs(threshold))
Data = stats.scoreatpercentile(dfx['column_name'], np.abs(threshold))
O, l, Data
不幸的是,我收到以下错误
ValueError: percentile must be in the range [0, 100]
我已经做了一些研究,但对于这个错误没有太多帮助
【问题讨论】:
-
你的程序中
threshold的值是多少? -
@Guimute,刚刚检查了一下,发现它比 100 大得多,所以现在我被卡住了,不知道如何解决这个问题,考虑到阈值应该保持这样
-
那你想要哪个百分位?
100 * threshold / max value of your data也许? -
由于您的
threshold可以超过100--您在对答案的评论中说它可以高达6400--我想知道您是否使用了正确的功能。你真的了解scoreatpercentile的作用吗?
标签: python pandas numpy csv scipy