I am trying to create a pandas dataframe with one row using and ended up testing the following simple line of code:
df = pd.DataFrame([1,2,3,4], columns=['a', 'b', 'v', 'w'])
Although this seems very simple i get the following error
Shape of passed values is (1, 4), indices imply (4, 4)
I have seen a few answers on this issues but all provide a way around it that doesn't explain why this happens and does not apply in my case.
Thanks is advance.
you need to change the list of values to [[1,2,3,4]]
df = pd.DataFrame([[1,2,3,4]], columns=['a', 'b', 'v', 'w'])