So I have this df1:
ID State
1 AA
2 AA
3 ZF
3 CJ
and df2:
ID AA ZF CJ etc
1 9 8 77
2 7 6 5
3 8 88 6
I have to create a new column in df1 bringing the values in df2 like this:
ID State Value
1 AA 9
2 AA 7
3 ZF 88
3 CJ 6
I've been trying for 2 hours now and I can't seem to find a way to refer to the column names on df2 based on the values of df1['State']. Even if I could think of a way to do that, the value is filtered by ID too... tricky stuff. Any help?
Thank you in advance