This question is very similar to an old one, with an important difference: I have a key based on multiple columns. Anyway, like in the linked question, I don't want a merge of 2 dataframes, but an insert of a new column (based on a vlookup equivalent).
As a concrete example let's say I have a dataframe df2.dtypes
Fruit object
Qty int64
Year int64
and another dataframe df3.dtypes
Manager object
Fruit object
Year int64
and I assume I can build a key composed by Fruit and Year for both of them.
I've tried to do
df2.insert(1, 'Manager', df2.set_index(['Fruit','Year']).map(df2.set_index(['Fruit','Year'])['Manager']))
But I'm getting
AttributeError: 'DataFrame' object has no attribute 'map'
How can I rephrase it (in order to detour the issue)?