Good morning all. I want to create a binning column in my main dataframe using data from a second one. Dataframe#1 has "Runner ID" and "Cumulative Distance" columns. Dataframe#2 has "Runner ID", "Section Start" and "Section Name" columns I'm trying to create a third column on Dataframe #1 named "Section Name Binning" based on matching "Runner ID" in both dataframes, and then binning "Cumulative Distance" from Dataframe#1 using the data from columns "Section Start" and "Section Name" from Dataframe#2. "Cumulative Distance" from Dataframe#1 and "Section Start" from Dataframe#2 will always be in increasing order and they restart when "Runner ID" changes. Attached a picture and Dataframes samples. As always appreciating your support.
df1=pd.DataFrame({'Runner_ID':['John','John','John','John','John','John','John','John','John','John','John','Jen','Jen','Jen','Jen','Jen','Jen','Jen','Jen','Jen','Jen','Jen'],'Cumulative_Distance':[1,1.5,1.8,3,3.2,3.7,4,4.3,5,6.6,8,2,2.3,2.8,3.2,3.5,3.9,4.8,5,5.3,5.8,6]})
df2=pd.DataFrame({'Runner_ID':['John','John','John','Jen','Jen','Jen','Jen'],'Section_Start':[0,3,5,0,2.5,3.5,5], 'Section_Name':['Flats', 'Uphill', 'Downhill', 'Flats', 'Uphill','Curve', 'Downhill']})