0

I want to compare two group fields in attribute table, which are related to the name of villages.

The name of these villages (in both field) are the same but they have in some cases differentiation (because of misspelling).

In order to update my databases I need to find different names and edit them.

They are many names and it doesn't make sense to check them manually.

I think Python or VBA code in ArcGIS is practical.

How can this be done?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 17, 2013 at 0:14
1
  • Is using Python or VBA code a requirement for you or just the only way you thought your question could be answered? Are you talking about doing fuzzy text comparisons? Commented Nov 18, 2013 at 9:07

3 Answers 3

1

There is no need to use code to find the mismatched village names so I am going to assume that doing that is not a requirement. I am also going to assume that you are comparing village name fields from two shapefiles.

First Join the two shapefiles based on their village name field (I have used Name and did this from the Attribute Table). Make sure that you choose to Keep all records.

enter image description here

When you hit OK you should find that any villages with the same name recorded in both shapefiles have null values in the joined field. In the graphic below I have clicked on that record to highlight it.

enter image description here

You can then do a Select By Attributes and use "name"<>"name_1" or whatever the two similar name fields are. Then you will have the different ones selected and can just click on the Show Only Selected icon and just edit those.

answered Nov 17, 2013 at 0:50
2
  • 1
    You can then do a select by attributes and use "name"<>"name_1" or whatever the two similar name fields are. Then you have the different ones selected and can just click on the show only selected icon and just edit those. Commented Nov 17, 2013 at 2:29
  • @Mike - I've updated my Answer with your excellent suggestion - thanks! Commented Nov 17, 2013 at 3:09
1

If you are talking about doing fuzzy text comparisons, check out the answers to this question on StackOverflow. Particularly, the built-in difflib module can do this.

answered Nov 17, 2013 at 4:05
0

create a test field, type short. apply this code in field calculator:

  1. choose "python" as a parser:
  2. check show block:
  3. write these line in pre-logic text-box: def test(a,b): if a==b: return 1 else: return 0
  4. at the last text box write this line: test(!field1!,!field2!)
  5. Field1 and field2 should be your two field to be compared:
  6. Then you can find the different values on test field, rows with number 1 are same and the rows with 0 are different:
karpfen
2,3571 gold badge19 silver badges34 bronze badges
answered Aug 1, 2016 at 12:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.