I have a dataframe df1
df1 = pd.DataFrame({'c1': [1],
'c2': [2],
'c3': [3]})
I want to add columns to this dataframe using a dictionary dict
my_dict = {'c4': 4, 'c5': 5}
so I ultimately want df1
to become
df2 = pd.DataFrame({'c1': [1],
'c2': [2],
'c3': [3],
'c4': [4],
'c5': [5]})
What I have found on SO is only example where a dictionary is turned into a DataFrame along the rows, e.g. this thread - and not along columns as in the above question.