Question: only size-1 arrays can be converted?
Answer: You are getting the error "only length-1 arrays can be converted to Python scalars" is because when the function expects a single value instead of that you have passed an array. Once you will look at the call signature of np.int, you'll see that it accepts a single value, not an array.