I'm trying to combine two data frames, where the one contains duplicates of the other data frame. I want the duplicate values to get the same values as the unique ones from the other data frame.
I have tried to use the 'merge' and 'join' function in Pandas, but either give me the desired result.
df1 = pd.DataFrame({'Number': np.arange(3),
'Class':['a','b','c']})
df2 = pd.DataFrame({'Number':[0,1,2,2,1,1,0,2,0,0]})
I have two data frames and want to obtain a data frame which extends the class label of df1 on to the duplicate values in df2, so something like:
df3: {'Number'} {'Class'}
0 0 a
1 1 b
2 2 c
3 2 c
4 1 b
5 1 b
6 0 a
7 2 c
8 0 a
9 0 a