Skip to content Skip to sidebar Skip to footer

Pandas: Duplicate Rows From Small Dataframe To Large Based On Cell Value

I have two sets of numerical data. One is much larger than the other. The same data from the smaller set applies to the larger set multiple times. For example, where B is the data

Solution 1:

you need, pd.merge

 df=pd.merge(df1,df2,on='A')

 df=df[['A','D','B']]

Post a Comment for "Pandas: Duplicate Rows From Small Dataframe To Large Based On Cell Value"