I am building a toolbox. I am stuck at the last step in my python script tool. I have csv file located outside the project folder (outside ArcGIS env). I need to join the csv to a featureclass in the project. I have tried arcpy.management.AddJoin() method to directly join the csv table to fc, but that doesn't work; I assume because the csv table is outside ArcGIS env.
Then I tried to convert the csv to dBase using TableToDBASE_conversion and TableToTable_conversion to see if that works, but the conversion is not happening, seemingly the input csv table cannot be read:
ERROR 000735: Input Rows: Value is required
Anyhow, the objective is to join the csv table from outside ArcGIS to the featureclass.
Is there a straightforward way to accomplishing this task by relying on arcpy and os libraries? I have seen a suggestion of geopandas but I do not want a geopandas based solution.
Here is the code I have...
# set the environment variables
arcpy.env.overwriteOutput = True
arcpy.env.workspace = gdb
# Export Table conversion for bringing the table into ArcGIS
arcTable = arcpy.TableToDBASE_conversion(Input_Table=t, Output_Folder=folder)
# t is a pandas dataframe that is exported to_csv()
# Process to creating a new layer
s = arcpy.management.AddJoin(in_layer_or_view=appropriate_shapefile
,in_field=Join_Field_on_Shapefile
,join_table=arcTable
,join_field='UID'
,join_type='KEEP_COMMON')
arcpy.conversion.ExportFeatures(s, layer_name)
arcpy.management.RemoveJoin(s)