Select to view content in your preferred language

Need to truncate/remove leading characters with Calculate Field

791
2
Jump to solution
06-13-2023 07:32 AM
Craig_Eissler_Iceman
Occasional Contributor III

Hello, I simply need to truncate (remove) some leading characters with the Field Calculator, but can't recall which Python command I need to use. The purpose is to create a common field to Join Census Data with TIGER. See below:

Craig_Eissler_Iceman_0-1686666707842.png

 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Depending on your naming scheme:

# if it's always the same start:
!GeoID!.replace("1000000US", "")

# if the number can change:
!GeoID!.split("US")[-1]

Have a great day!
Johannes

View solution in original post

2 Replies
JohannesLindner
MVP Frequent Contributor

Depending on your naming scheme:

# if it's always the same start:
!GeoID!.replace("1000000US", "")

# if the number can change:
!GeoID!.split("US")[-1]

Have a great day!
Johannes
Craig_Eissler_Iceman
Occasional Contributor III

Ah yes, "Replace" -- thanks!

0 Kudos