I want to calculate scores in one field based on the percentile (in steps of 10) the row falls into in another field. I found a solution here (Calculating Percentiles in ArcMap?) that I tried out, but I now get the error:
unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.ndarray'My code looks as follows:
input = "Buffer"arr = arcpy.da.FeatureClassToNumPyArray(input, ('Shape_Area'))p1 = np.percentile(arr, 10) p2 = np.percentile(arr, 20)p3 = np.percentile(arr, 30) p4 = np.percentile(arr, 40) p5 = np.percentile(arr, 50) p6 = np.percentile(arr, 60) p7 = np.percentile(arr, 70) p8 = np.percentile(arr, 80) p9 = np.percentile(arr, 90) p10 = np.percentile(arr, 100) #use cursor to update the new rank fieldwith arcpy.da.UpdateCursor(input , ['Shape_Area','ConS']) as cursor: for row in cursor: if row[0] < p1: row[1] = 0.1 #rank 0 elif p1
unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.ndarray'My code looks as follows:
input = "Buffer"arr = arcpy.da.FeatureClassToNumPyArray(input, ('Shape_Area'))p1 = np.percentile(arr, 10) p2 = np.percentile(arr, 20)p3 = np.percentile(arr, 30) p4 = np.percentile(arr, 40) p5 = np.percentile(arr, 50) p6 = np.percentile(arr, 60) p7 = np.percentile(arr, 70) p8 = np.percentile(arr, 80) p9 = np.percentile(arr, 90) p10 = np.percentile(arr, 100) #use cursor to update the new rank fieldwith arcpy.da.UpdateCursor(input , ['Shape_Area','ConS']) as cursor: for row in cursor: if row[0] < p1: row[1] = 0.1 #rank 0 elif p1