Select to view content in your preferred language

Re: delete duplicates records based on field

292
3
04-11-2023 01:37 AM
Sebastian-VlăduțCristea
New Contributor

Hello!

I have this repetitive "RO." and I want to delete but keep "AB, AR, AG, BC ... etc". How can I do that?

Tags (1)
0 Kudos
3 Replies
AlfredBaldenweck
MVP Regular Contributor

Try a field calculator.

In Arcade:

Replace($feature.HASC_1, "RO.", "")

Test on one record before doing the whole table. 

BlakeTerhune
MVP Regular Contributor

Yep. Calculate Field is what you want. For variety, here's the Python equivalent.

!HASC_1!.replace("RO.", "")

 

0 Kudos
by Anonymous User
Not applicable

@Sebastian-VlăduțCristeaI moved this to be its own question because that thread was posted back in 2016.

To remove the RO. you can use an update cursor:

with arcpy.da.UpdateCursor(fc, ['HASC_1']) as uCur:
    for row in uCur:
        row[0] = row[0].split('.')[-1]
        uCur.updateRow(row)

 

updatecursor-class.htm 

0 Kudos