TypeError: only integer scalar arrays can be converted to a scalar index reshape numpy code example
Example 1: 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.
Example 2: only integer scalar arrays can be converted to a scalar index pandas
df1 = pd.DataFrame({'a': [1, 2]})
df2 = pd.DataFrame({'b': [3, 1]})
df1.columns = ['b']
df1.merge(df2, on='b')