plt bar only size-1 arrays can be converted to Python scalars code example
Example: TypeError: only size-1 arrays can be converted to Python scalars
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.