Finding unusual value in an array, list
问题 I have sales statistic data in array form to calc standard deviation or average from this data. stats = [100, 98, 102, 100, 108, 23, 120] let said +-20% differential is normal situation, 23 is obviously a special case. what's the best algorithm (in any language, pseudo or any principle) to find this unusual value? 回答1: You could convert them to Z-scores and look for outliers. >>> import numpy as np >>> stats = [100, 98, 102, 100, 108, 23, 120] >>> mean = np.mean(stats) >>> std = np.std(stats)