Join Pandas Dataframe to Shapefile?

by ATCH_torn   Last Updated August 15, 2018 16:22 PM

I have a shapefile:

Street1    Street2    Street3
Field      Clark      Taylor
Field      Jackson    State
Franklin   23rd       25th

And a Dataframe df:

Page    Entry_Date
12      08012018
17      07252018
11      07252018

The only commonalities between the two are the index position of the rows. I'd like to join them together so my result is as below in my shapefile

Street1    Street2    Street3    Page    Entry_Date
Field      Clark      Taylor     12      08012018
Field      Jackson    State      17      07252018
Franklin   23rd       25th       11      07252018

I've tried a couple ways but it doesn't seem that arcpy likes to cooperate with pandas

in_shp = "C:\\Users\\Anthony\\Proj56\\ExportShp.shp"

for idx, row in df.itterrows():
    arcpy.JoinField_management(in_shp, "FID", df, idx, [df.columns.values])

This just gives me an error. Is there any way to incorporate a pandas dataframe into an existing shapefile without completely rewriting everything?



Related Questions


Updated July 04, 2018 11:22 AM

Updated January 31, 2018 23:22 PM

Updated January 12, 2018 01:22 AM

Updated April 05, 2017 15:22 PM

Updated April 13, 2017 16:22 PM