AnsweredAssumed Answered

How do I use the minimum and maximum values from a single column in python or VBscript?

Question asked by Dcamrine on Sep 23, 2014
Latest reply on Sep 25, 2014 by bixb0012

GEONET,

 

    Essentially i want to normalize the Value field (VAL) in a series of point layers using an expression in python or VBscript. I have spent all morning browsing "The Web" for examples and all i can find are long expressions using the code block and that involves building a list of the values and selecting the highest or lowest.

 

The equation is (x-min(x))/(max(x)-min(x))....

 

In the python expression I tried FieldB = (!VAL! - min([!VAL!]))/(max([!VAL!])-min([!VAL!])) this returned

 

ERROR 000539: Error Running expression:(38.891808-min([38.891808]))/(max([38.891808]) etc...

 

It's reading the value from the field rather than the actual minimum which is 3.285462

 

I also tried FieldB = min([!VAL!]) and it returned the values for each record rather than actual minimum value in each record.

 

I would really love to have the ability to run a single expression on each of these layers rather than summarizing each individual table and then plugging the values in by hand. This requires going through each layer individually and this will be extremely time consuming and it seems like there should be a smarter way.  

 

Any help on this is much appreciated!

Dan

Outcomes