AnsweredAssumed Answered

Eliminating data outliers using Python Parser of ArcGIS Field Calculator?

Question asked by GoldenJiang on Aug 29, 2016
Latest reply on Sep 5, 2016 by Dan_Patterson

For a while I've been using boxplot and definition query in ArcGIS to eliminate data outliers. It is a painful process when dealing with a lot of files and difficult to ensure the consistency.


I don't know much python but I want to try something like replacing outliers as `Null` in python parse of field calculator:


def function(x):
qnt = quantile(x, probs=c(.25, .75));
H = 1.5 * IQR(x);
y[x < (qnt[1] - H)] = "";
y[x > (qnt[2] + H)] = "";
return y


Then output in my new field function`( !Yield_kg__! )` but it turns out failure below:


 ERROR000539:Error running expression: function(0.0)
 Traceback (most recent call last)
 File "<expression>", line1, in <module>
 File "<string>', line2, in function
 NameError: globe name 'quantile' is not defined


Can anyone tell me how to fix this?