The X Coordinates and Y Coordinates exist in the csv. However, I still get this error. Can anyone help?
ExecuteError: Failed to execute. Parameters are not valid. ERROR 000728: Field X Coordinates does not exist within table ERROR 000728: Field Y Coordinates does not exist within table Failed to execute (MakeXYEventLayer)
# Description: Creates an XY layer and exports it to a layer file
# import system modules
import arcpy
import csv
arcpy.env.workspace = "C:/GEO345/Lab4/Lab4/"
# Set the local variables
in_Table = "C:\\GEO345\\Lab4\\Lab4\\Crimes_-_2010.csv"
out_Layer = "crime_2010_layer"
saved_Layer = r"c:\GEO345\Lab4\Lab4\crime_2010.lyr"
# Set the spatial reference
sr = arcpy.SpatialReference(4326)
# Make the XY event layer...
arcpy.MakeXYEventLayer_management(in_Table, 'X Coordinates', 'Y Coordinates', out_Layer,
sr)
# Save to a layer file
arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)