admin 管理员组

文章数量: 1086019

I'm new to python and unfortunately I'm not sure how to share a reproductible example. I'm looking for anomalies in a dataset for an anti-fraud exercice. I'm trying to use the Z-score to find outliers. However, I get an error code. I think the issue is the shape of the data (not sure) but I have no idea how to fix that. Any pointer would help! thanks!

from scipy.stats import zscore
daily_fraud['zscore'] = zscore(daily_fraud.values)
anomalies = daily_fraud[daily_fraud['zscore'].abs() >2]

~\Anaconda3\lib\site-packages\scipy\stats\stats.py in zscore(a, axis, ddof)
   2313                 np.expand_dims(sstd, axis=axis))
   2314     else:
-> 2315         return (a - mns) / sstd
   2316 
   2317 

ValueError: operands could not be broadcast together with shapes (183,) (182,) 

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)