I could not find a solution to this problem because the length of the indexes of the two dataframe is not the same so it prevents me from using all the pd.merge, join, etc..
Here is a toy model of what I try to do:
data1= pd.DataFrame({'Supplier' : ['001', '001', '001', '001', '002', '002', '002', '003', '003', '003'],'Quantity' : [200,20,50,40,210,47,66,53,100,60]})
data2 = pd.DataFrame({'Supplier': ['001', '002', '003'], 'lead_time' : [7,7,7]})
and I need to get:
data3 = pd.DataFrame({'Supplier' : ['001', '001', '001', '001', '002', '002', '002', '003', '003', '003'],
'Quantity' : [200,20,50,40,210,47,66,53,100,60],
'lead_time' : [7,7,7,7,7,7,7,7,7,7]})
following Matching Pandas DataFrame Column Values with another DataFrame Column, I tried doing:
data1.join(data2
.set_index("lead_time")
.loc[:, data1["lead_time"]],
on="lead_time")
without success, and I am out of ideas, any help on this issue would be much appreciated.