You need to use & instead of and with NumPy arrays:
mask = (data[:,0] == ptype) & (data[:,8] <= radius)data[mask,7].sum()
You need to use & instead of and with NumPy arrays:
mask = (data[:,0] == ptype) & (data[:,8] <= radius)data[mask,7].sum()