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?

  • 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? – PolyGeo Nov 18 '13 at 9:07
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.

  • 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. – mike Nov 17 '13 at 2:29
  • @Mike - I've updated my Answer with your excellent suggestion - thanks! – PolyGeo Nov 17 '13 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.

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.