I have two DataFrames of different sizes.
df1 = pd.DataFrame()
df2 = pd.DataFrame()
df1["id"] = ["A", "A", "B", "B", "C", "C"]
df1["revenue"] = [1, 2, 10, 9, 11, 14]
df2["id"] = ["A", "B", "C"]
df2["revenue"] = [12, 1, 5]
I want to create a new column in df1 titled revenue_year_1 and fill it with the revenue values in df2 conditional on the id values being equal. So in df1 in both lines where the id is 'A' revenue_year_1 would be 12, where the id is 'B' the revenue_year_1 would be 1 and where the id is C the revenue_year_1 would be 5. In practice I'm doing this on a larger data set where I would not be able to do this by hand.
Desired outcome:


