Select to view content in your preferred language

Address Field suffixes saved to new field?

1004
4
Jump to solution
10-04-2022 12:03 PM
TimHayes3
Frequent Contributor

I have an address point feature class. I want to extract only the address suffixes in the Address Field into a new field named Suffix. What is the best approach to do this? (I am new to ArcPy, if someone has the code, would you mind posting it? or if there is a better way than using ArcPy?)

Example: 123 Main St

I want St to be placed in a new Suffix field. 

There are 5,000 addresses in the feature class. 

 

0 Kudos
2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

 

python parser, replace fld with !TheNameOfYourField! with the ! marks

fld = "123 Main St"
fld.split(" ")[-1]

 


... sort of retired...

View solution in original post

JoshuaBixby
MVP Esteemed Contributor

Dan's code will work on all of the examples you provided.

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

 

python parser, replace fld with !TheNameOfYourField! with the ! marks

fld = "123 Main St"
fld.split(" ")[-1]

 


... sort of retired...
TimHayes3
Frequent Contributor

That is partially helpful. But the addresses also include suffixes such as:

123 Main St

4561 Buck Ave

90312 Goode Blvd

Any thoughts on how best to handle 3 and 4 letter prefixes?

0 Kudos
TimHayes3
Frequent Contributor

Would this work for the 2, 3, and 4 letter suffixes?

 

fld = "123 Main St"
fld.split(" ")[-4]

 

 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Dan's code will work on all of the examples you provided.