I want to calculate the mean value in the field z
which has Type Zero
and write it in Ground field.
How can I do that with arcpy?
arcpy.MakeFeatureLayer_management(Shapefile, "layer")
arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION","Type = 0")
arcpy.CalculateField_management("layer", "Ground", "mean(!{0}!)".format("Z"), "PYTHON_9.3")
I have got error for this code.