import arcpy
arcpy.env.overwriteOutput = True
workspace = "C:/Data"
try:
arcpy.env.workspace = workspace
cf = arcpy.management.CopyFeatures("911Calls.shp", "911Copied.shp")
integrate = arcpy.management.Integrate("911Copied.shp #", "500 Feet")
ce = arcpy.stats.CollectEvents("911Copied.shp", "911Count.shp")
af = arcpy.management.AddField("911Count.shp", "MyID", "LONG", "#",
"#", "#", "#", "NON_NULLABLE", "NON_REQUIRED", "#",
"911Count.shp")
cf = arcpy.management.CalculateField("911Count.shp", "MyID",
"!FID!", "PYTHON")
swm = arcpy.stats.GenerateSpatialWeightsMatrix("911Count.shp", "MYID",
"euclidean6Neighs.swm",
"K_NEAREST_NEIGHBORS",
"#", "#", "#", 6,
"NO_STANDARDIZATION")
hs = arcpy.stats.HotSpots("911Count.shp", "ICOUNT", "911HotSpots.shp",
"GET_SPATIAL_WEIGHTS_FROM_FILE",
"EUCLIDEAN_DISTANCE", "NONE",
"#", "#", "euclidean6Neighs.swm")
except arcpy.ExecuteError:
print(arcpy.GetMessages())