AnsweredAssumed Answered

calculation within an IF statement in arcGIS Pro

Question asked by mdolan26 on Aug 10, 2018
Latest reply on Aug 13, 2018 by mdolan26

I'll begin by stating I am very new to the python world! 

My problem is this....

 

I am trying to use field calculator in ArcGIS Pro to return a calculation of values in other fields based on an if statement, if that makes sense! Not sure if it can be done?

 

The Calculation is 

Qrp=Sum(Qs*Ls)/SumLs

 

Basically thus;

 

weightAADT(!rp!,!Qs!,!Ls!)

 

Code Block

def weightAADT(rp, Qs, Ls):
       if rp=="Urban Two Lane":
            return sum(Qs * Ls) / sum(Ls)

 

my error is "TypeError: 'float' object is not iterable"

 

Any help appreciated

Outcomes