I have two dataframes and I'm trying to migrate data from one df1 to my main df.
They share a common key - and I want to store the values from a df1 row into a df column. This I could do.. however df1 can have multiple rows (max 5) that share the common key and I would like to store each row in an individual column.
Using an example:
df
index key datacol
1 1AA data1
2 1AB data2
3 1AC data3
df1
index key newdata
1 1AA new1
2 1AB new2
3 1AB new3
4 1AB new4
5 1AC new5
6 1AC new6
Output:
index key datacol newcol1 newcol2 newcol3
1 1AA data1 new1
2 1AB data2 new2 new3 new4
3 1AC data3 new5 new6
Appreciate your assistance.