I need to merge two data frame with different rows and without common key:
df1:
name | age | loc
Bob | 20 | USA
df2:
food | car | sports
Sushi | Toyota | soccer
meat | Ford | baseball
result I want:
name | age | loc | food | car | sports
Bob | 20 | USA | Sushi | Toyota | soccer
Bob | 20 | USA | Meat | Ford | baseball
my code below:
pd.merge(df1,df2,how='right',left_index=True,right_index=True)
it works well when df2 is more than two rows but be incorrect when df2 is only one row.
any ideas for this question?