I am very new to python scripting. I need to be able to run this function through python to use on multiple different datasets. Basically, I am trying to multiply an attribute column by a factor of the mean of that column depending on the ratio of that attribute to the mean.

This is what I've got so far:

expression = fuzExp(H_Income_M)

codeblock = """def fuzExp(H_Income_M)

if (H_Income_M) <= (MEAN*2):

return (1/MEAN)*H_Income_M

else:

return 1"""

I've also calculated the mean in a summary statistic table. I'm just looking for a way to get the mean value into the above function.

Any help would be greatly appreciated!!!

This is what I've got so far:

expression = fuzExp(H_Income_M)

codeblock = """def fuzExp(H_Income_M)

if (H_Income_M) <= (MEAN*2):

return (1/MEAN)*H_Income_M

else:

return 1"""

I've also calculated the mean in a summary statistic table. I'm just looking for a way to get the mean value into the above function.

Any help would be greatly appreciated!!!

If your mean is for unique values from another column in your data, then join the summary table on that field and use an expression that supplies two parameters. If the summary was on all records then the easiest way to create a join is add a field to the original table that just holds a value like 0 for all records and then add a similar field to the summary table. Below are the code lines you would have to change (make sure the expressions uses the actual field names that are really in your joined tables).

expression = fuzExp(!MaintTable.H_Income_M!, !SummaryTable.MEAN!)

codeblock = """def fuzExp(H_Income_M, MEAN)