admin管理员组

文章数量:1026989

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,) 

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,) 

本文标签: