I was trying to create a column with python and pandas that aggregate two other columns Like
Investiments (Columns Jhon | Camile (2 different columns)
test = {'Jhon':{'Investments':[100,200,300]},'Camile':{'Investments':[200.300,-150]}}
test2 = {'Investments':{'Jhon':[987,654,321], 'Camile':[654,321,159]}}
I tried to create a date frame from those two dictionaries, but, both failed to created the expected result on the DataFrame(). I guess this isn't possible, but, i just want to make sure.
The expected result enter image description here
CodePudding user response:
I think this is what you want:
test3 = {('Investments','Jhon'):[987,654,321], ('Investments','Camile'):[654,321,159]}
pd.DataFrame(test3)
output
Investments
Jhon Camile
0 987 654
1 654 321
2 321 159
