I'm trying to join a shapefile to a csv file. The join works but the attribute table has the long name of the shapefiles which makes the fields not readable.
How can i fix this problem?
Calling the scrip from an os window as
C:/Python27/ArcGIS10.4/python csv_2_dbf_tdm.py "D:/01_Inputs/y2035/cube_se2035.csv" "no_bld_tdm_draft1"
where cube_se2035 is sys.argv[1] and the no_b;dm_tdm_draf1 is a folder name
import arcpy
import sys
import os
basename = os.path.basename(sys.argv[1]).replace(".csv", ".dbf")
dbf_path = sys.argv[1].replace(".csv", ".dbf")
se_shp = os.path.join(os.getcwd(), "data\se_folder_shapefile\se919.shp")
sys.argv[1] = se_path = "D:/cube_se{year}.csv".format(year=2035)
shapefileName = "temp"
arcpy.MakeFeatureLayer_management(se_shp,shapefileName)
###Join the feature layer to a table
arcpy.AddJoin_management(shapefileName, "DASZ2010",dbf_path, "dasz_id")
### Copy the layer to a new permanent feature class
arcpy.CopyFeatures_management(dd, os.path.join(cube_folder, basename.strip(".dbf")))
Here is the table after the join. All the fields have the source name and I just need the field name without the source.
addjoin
command, try adding in this command:arcpy.env.qualifiedFieldNames = False