Best Answer · By JanBask Python Expert
Answered on Feb 18, 2021
Here the error message says that for passing scalar values, you need to pass an index.
So you can either not utilize scalar values for the columns: >>> df = pd.DataFrame({'A': [a], 'B': [b]})
>>> df
A B
0 2 3
or use you can use scalar values and pass an index:
>>> df = pd.DataFrame({'A': a, 'B': b}, index=[0])
>>> df
A B
0 2 3