I've got 2 dataframes,
df1
col1 col2 col3
0 ABC XYZ123 RA100
1 DEF YHG753 RA200
2 ABC XYZ123 RA100
3 DEF YHG753 RA200
4 ABC XYZ123 RA100
5 DEF YHG753 RA200
df2
col5 col6
0 TU1 DUM1
1 TU2 DUM2
2 TU3 DUM3
I'm trying to concat each row of df1 with a randomly selected row from df2.
I've been trying with pd.concat(frames, axis=1), but concat wont work for me as shape of the dataframes are not matching. So I'm wondering whether there's a better way to do to do this rather than increasing the rows of df2 to match it with that of df1, then do concat.
Reference: Randomly concat data frames by row
Expected sample output:
col1 col2 col3 col5 col6
0 ABC XYZ123 RA100 TU3 DUM3
1 DEF YHG753 RA200 TU1 DUM1
2 ABC XYZ123 RA100 TU2 DUM2
3 DEF YHG753 RA200 TU2 DUM2
4 ABC XYZ123 RA100 TU3 DUM3
5 DEF YHG753 RA200 TU1 DUM1