I am trying to create a DataFrame with multiple indices and one column. If I type the following:
InitialPosition=pd.DataFrame( [1000000,1,1] ,index=['Cash'],columns=['a','b','c'] )
I get an error:
ValueError: Shape of passed values is (1, 3), indices imply (3, 1)
If I change the array to columns, like:
InitialPosition=pd.DataFrame( [[1000000],[1],[1]] ,index=['Cash'],columns=['a','b','c'] )
then the error I have is:
AssertionError: 3 columns passed, passed data had 1 columns
Do you know why this is happening?
One solution is to do:
InitialPosition=pd.DataFrame( [1000000,1,1] ,columns=['Cash'],index=['a','b','c'] ).T
but doesn't look very elegant.