import arcpy
arcpy.env.overwriteOutput = True
workspace = "C:/Data"
try:
arcpy.env.workspace = workspace
cf = arcpy.CopyFeatures_management("911Calls.shp", "911Copied.shp")
integrate = arcpy.Integrate_management("911Copied.shp #", "500 Feet")
ce = arcpy.CollectEvents_stats("911Copied.shp", "911Count.shp", "Count", "#")
af = arcpy.AddField_management("911Count.shp", "MyID", "LONG", "#", "#", "#", "#",
"NON_NULLABLE", "NON_REQUIRED", "#",
"911Count.shp")
cf = arcpy.CalculateField_management("911Count.shp", "MyID", "!FID!", "PYTHON")
swm = arcpy.GenerateSpatialWeightsMatrix_stats("911Count.shp", "MYID",
"euclidean6Neighs.swm",
"K_NEAREST_NEIGHBORS",
"#", "#", "#", 6,
"NO_STANDARDIZATION")
hs = arcpy.HotSpots_stats("911Count.shp", "ICOUNT", "911HotSpots.shp",
"GET_SPATIAL_WEIGHTS_FROM_FILE",
"EUCLIDEAN_DISTANCE", "NONE",
"#", "#", "euclidean6Neighs.swm")
except arcpy.ExecuteError:
print(arcpy.GetMessages())