Hello,
I am trying to join a table to feature class using a field (parcel ID) that is common to both of them. However, around 700+ parcel IDs (out of 6500+) are formatted incorrectly. For example:
I am trying to figure out how to edit these unmatched values in ArcGIS Pro so that the join proceeds. Is there a way to apply a rule - e.g. remove the 15th character (-) from the values on the left so that they match the values on the right?
Thanks!
Solved! Go to Solution.
Hey @dsinha
That is my bad I should have attached a screenshot, it should look something like this:
Cody
Hey @dsinha
If these are incorrect, would it be possible to just fix them? If the - is always at the 15th slot, you could use a calculate field function to fix this:
def remove(item):
if item and len(item) >= 15 and item[14] == "-":
return item[:14] + item[15:]
return item
I would test this on a small subset of data to ensure this does what you're expecting!
Cody
Thanks so much for your help @CodyPatterson!
I tried to run the expression but I got an error message (though the expression is valid):
Hey @dsinha
That is my bad I should have attached a screenshot, it should look something like this:
Cody
Thanks so much for sending the screenshot @CodyPatterson. Worked like a charm!
@CodyPatterson just curious - what would the expression look like if I want to remove any "-" after the 14th character?
Hey @dsinha
It should look something like this, you'd just have to rebuild the string which this does:
def remove(item):
if item and len(item) > 14:
prefix = item[:14]
suffix = item[14:].replace("-", "")
return prefix + suffix
return item
As with all code, just make sure that this is valid for your purposes and doesn't indirectly edit anything else!
Cody
Oh, this is beautiful! I wish I had your skills @CodyPatterson! Thanks a million!