Arcpy field calculator taking hours to process

135
3
08-06-2020 04:04 PM
New Contributor

So I have a loop that joins three fields from a csv, makes new fields with new names, calculates the fields based off the joined fields, and then deletes the original join field. This repeats 20 times with 20 different tables with 1000-2000 rows each. I attached a png showing the code, to help contextualize what is happening.

I'd expect it to take some time, as field calculations never seem all that speedy, but it takes hours for the code to get through this step, and has hurt my coworkers ability to access the shared drive I am doing the processing on.

I am wondering how I can improve the performance here, and what if anything I am doing wrong.

Thank you very much,

Xavier

Tags (2)
Reply
0 Kudos
3 Replies
MVP Regular Contributor

can you show the full code and expressions used?

Reply
0 Kudos
MVP Frequent Contributor

Convert your CSV files into proper tables, add an index on the fields you are joining by. You will much better performance.

MVP Esteemed Contributor

In addition to what Duncan Hornby‌ suggests, you may want to process the data locally.  I think vpn connections are great for working from home, but making the trip from my laptop to a shared drive and back for processing is horribly slow and just when you think everything is great, the vpn burps and you lose the connection...