AnsweredAssumed Answered

Remove all numbers/integer values from multiple fields

Question asked by CCweedcontrol on Aug 22, 2019
Latest reply on Aug 23, 2019 by bixb0012

I have some fields with alphabetic and numbers i want to remove all the numbers. I have tried some things but the issue i have is that the numbers are between the alphabetic text for example

 

Homeowners field

"Homeowners 456 Exempt",---> Homeowners Exempt

"456 Homeowners Exempt"--> Homeowners Exempt

"Homeowners Exempt 456" --> Homeowners Exempt

 

Irrigation

Hill Irrigation #2 Dist --> Hill Irrigation Dist

#2Hill Irrigation Dist --> Hill Irrigation Dist

Hill Irrigation Dist#2 --> Hill Irrigation Dist

 

Drain

High Drain #2 Dist --> High Drain Dist

#2High Drain Dist --> High Drain Dist

High Drain Dist #2--> High Drain Dist

 

I have tried .strip('0123456789. -#') but it only removes them from the beginning and end not in between.

Ive been working with this but i can't seem to get right. I would appreciate any help.

 

fc = r"C:\Temp\Lyr1"
fields = ['HomeOwners', 'Irrigation', 'Drain']
exp = ''.join(c for c in fields if not c.isnumeric())
arcpy.management.CalculateField(fc, fields, exp, "PYTHON3")

 get the following error

 

RuntimeError: Object: Error in executing tool

Outcomes