Lets say I have a dataframe like
df = pd.DataFrame({'A':[1,2,3,4],'B':[1,3,4,7]})
A B 0 1 1 1 2 3 2 3 4 3 4 7
When I assign some data to transpose of a dataframe, there is no error i.e
df.T['C'] = 3
There is no change in the dataframe after running this.
But the question is where is the data being stored ? Why did't it give any error? I was expecting an error for this kind of assignment or an output like
A B 0 1 1 1 2 3 2 3 4 3 4 7 C 3 3
Neither is happening when I did df.T['C'] = 3
Edit: as @Zero mention we might have to do
df = df.T.assign(C=3).T # Which is like df.loc['C',:] = 3