1

I am using ArcMap 10 from ArcGIS 10.2.1 package.

I got an attribute table, with few collumns. I need to replace some column "String_A" entries with newer "String_B" entries, in the same row. In both "String_A" and "String_B" columns are some values. Some entries in column "String_A" dont need to be changed, only those, where "String_B" entries not . Both columns are strings.

I am doing it by hand for now, but it would be nice to have a script in Python that can do it for me, because from time to time I need to update table with some new entries.

I am learning Python, but with my knowledge for today I can't do this task. So, I need some help with Field calculator and Python.

From "String_B" to "String_A" replace entries, example in the picture:

enter image description here

1

If I'm understanding, you want to replace values in field A with values from column B when the value in field A doesn't match the value in field B, is that correct? If so, you don't really need a python script. Simply select all values where field A <> field B (or alternately, select where field A = field B and then switch selection). Then run Field Calculator on Field A, setting it equal to field B. Field Calculator will only run on the records you selected.

I apologize if that's not what you meant. If you still want python code, post that and you shall have it.

  • Thanks for your answer! It helped! Exactly what I needed. – risk_ltu May 16 '14 at 5:59

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.