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.