AnsweredAssumed Answered

Calculate Field based on another field using Python

Question asked by 1968Tigers on Aug 3, 2018
Latest reply on Aug 5, 2018 by bixb0012

I am working on a TIGER line file of roads in my county in shapefile format (although I am having the same problem with geodatabase format). I am attempting to update a created field named SpeedMPH based on another field. If the field named ROAD_MTFCC is equal to S1200 then update the SpeedMPH field to 25. My code block is written in Python 3.6 and I am running ArcGIS Pro 2.2.1 with the latest updates. My code block is:

def Reclass(fld):
if(ROAD_MTFCC == 'S1200'):
return 25
elif(ROAD_MTFCC == 'S1400'):
return 35
elif(ROAD_MTFCC == 'S1500'):
return 45
elif(ROAD_MTFCC == 'S1640'):
return 55

I then click the green check to verify my code and it is accepted. I click the run button and it runs for a few seconds. When I look at my TIGER line file of roads attribute table the SpeedMPH field is NULL. Nothing was updated. 

What am I doing wrong?

Enclosed is a picture of the Calculate field window and a 7zip of my TIGER line shapefile. It is pretty standard Census data.if then code block Python

Outcomes