1

I would like to know if there is a way to incorporate an external csv file into a custom made python script in ArcMap field calculator. I am inputting fields from the current layer, but need to access an external csv containing the mapping for these fields to convert them to values of interest. Is this at all possible?

  • 1
    Yes, but I think it would be easier to just use the Join Field tool. – PolyGeo Nov 11 '15 at 5:48
  • Agree with polygeo. A join is certainly easier. But if you wanted to you could import the csv module and read the file that way. – Fezter Nov 11 '15 at 5:50
  • I agree as well. I just tried it and a table join does exactly what I need. – user32882 Nov 11 '15 at 6:27
1

Yes, as @Fezter commented:

if you wanted to you could import the csv module and read the file that way

but I think it would be easier to just use the Join Field tool:

Joins the contents of a table to another table based on a common attribute field. The input table is updated to contain the fields from the join table. You can select which fields from the join table will be added to the input table.

The records in the Input Table are matched to the records in the Join Table based on the values of Input Join Field and the Output Join Field. Optionally, only desired fields can be selected from the Join Table and appended to the Input Table during the join.

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.