Hi,
I am trying to fix my attribute records in Arcmap.
Is there a way to do a bulk fixing, to find all my St and change it to Street?
Here's a simple Python field calculator example:
!fieldnamehere!.replace(' ST', ' STREET')
Longer example for addressing multiple changes. Use your fieldname instead of FacilityAddress.
def StreetSuffix(FacilityAddress): list = FacilityAddress.split() for item in range(len(list)): if list[item] == 'STREET': list[item] = list[item].replace("STREET", "ST") if list[item] == 'STREET,': list[item] = list[item].replace("STREET,", "ST") if list[item] == 'STR.': list[item] = list[item].replace("STR.", "ST") if list[item] == 'STR,': list[item] = list[item].replace("STR,", "ST") if list[item] == 'ST.': list[item] = list[item].replace("ST.", "ST") if list[item] == 'ST,': list[item] = list[item].replace("ST,", "ST") if list[item] == 'WAY': list[item] = list[item].replace("WAY", "WY") if list[item] == 'WAY,': list[item] = list[item].replace("WAY,", "WY") if list[item] == 'WY.': list[item] = list[item].replace("WY.", "WY") if list[item] == 'WY,': list[item] = list[item].replace("WY,", "WY") return " ".join(list)
Credit to Darren Wiens and several others knowledgeable in Python for coming up with this, which I gratefully stole borrowed.
Chris Donohue, GISP
@ChrisDonohue__GISP
I just wanted to thank you for posting this field calculator expression. I needed to update addresses in a single field to change all abbreviations to fully spelled out words. I used this expression in ArcGIS Pro, created a list of changes I needed, and updated over 16000 records with little issues. It worked great!! A huge time saver, and I learned some good skills from it.
Thank you!
Jon
Now that I see this again, a more compact alternative may be (only lightly tested):
def StreetSuffix(FacilityAddress): replace_dict = { 'ST':['STREET','STREET,','STR.','STR,','ST.','ST,'], 'WY':['WAY','WAY,','WY.','WY,'] } list = FacilityAddress.split() for item in range(len(list)): for key, value in replace_dict.iteritems(): if list[item] in value: list[item] = key return " ".join(list)
Got it fixed. Saved me tons of hours.
Thanks Darren!
Or select thuroghfare trailingtype = 'ST' and then calc thuroghfare trainingtype = "STREET"
Yes, this can be done in Python. The Python code can be placed in the field calculator, or a pure Python run can be done.
There is Find and Replace in Table options.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.