I have a field called Address. And example of a record in that field is 900 Main St. I need to get "Main" into a field called Street Name. I already parsed out the street number(900) and the street type (St), but can't figure out how to do the name. I'm working in ArcMap, so I would like to do it right in the table field calculator. I have over 7,000 records I need to do this to.
Thanks
Solved! Go to Solution.
Steven,
I had more of a thought about this and to make it more robust it would be better to use the following python snippet:
def convertName(address):
newname = ""
newaddress = address.split(" ")
for word in range(1,len(newaddress) -1):
newname = newname + newaddress[word] + " "
return newname[:-1]
to use in the field calculator follow the screenshot:
If you are using the field calculator, switch the parser to python and use the following:
!address!.split(" ")[1]
what this does is split the address field each time there is a space then uses the second item in the array (the array is zero based), it will only work if your address are all in the format of number streetname streettype.
if you have street names with more spaces in then you will need to do some combination of if statements on the length of the array to handle the results, let me know if you need more advice
Steven,
I had more of a thought about this and to make it more robust it would be better to use the following python snippet:
def convertName(address):
newname = ""
newaddress = address.split(" ")
for word in range(1,len(newaddress) -1):
newname = newname + newaddress[word] + " "
return newname[:-1]
to use in the field calculator follow the screenshot:
No problem Steven, please return the favour by marking my post as the correct answer and helpful