1

I have an arcpy script that joins two tables together based on the FID field. This slows down my script considerably. The joining process takes several tens of minutes.

import arcpy
import os
from arcpy.sa import *
arcpy.JoinField_management("Selection_median_direction.shp", "FID", "Selection_median_length.shp", "FID", "length;Median_len")

I've found this tool which takes input from geodatabases (I have shapefiles): ArcGIS Online Tool. I can't get it to run as an arcpy stand-alone script. Is there another approach to fasten up the join field step? I am running several tasks such as e.g. the clip, erase and intersect tools and the join field command is only a part of my final script which takes up most of the processing time. This is why I was wondering if anyone has a faster solution for standalone arcpy scripts to speed up this process?

1
  • 1
    Join field can be very slow, dont know why. Have you tried adding an attribute index prior to join field? I have stopped using Join Field, instead i: Add field, Add join, calculate field, remove join. Or use a da.SearchCursor to create a dictionary and use with the da.UpdateCursor.
    – BERA
    Jun 6, 2018 at 9:21

1 Answer 1

1

To solve perfomance problem you can try to:

1) Use arcpy.AddJoin_management to add fields to the layer then

2) Do your job (for example, use arcpy.CalculateField_management to fill the field values) and then

3) Remove join arcpy.RemoveJoin_management

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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