This is somewhat basic, but I couldn't find a simple answer. In Python have a dataframe A like this:
ItemId Price
------- -------
0 a1 10.0
1 a1 15.0
2 a2 8.0
3 a3 7.0
And a second one, B, like this, where item ids appear only once, they are index:
ItemId Discount
------ ---------
a1 0.2
a2 0.5
a4 0.3
I want to subtract 'Discount' values (from B) from 'Price' of dataframe A, by matching Item Ids, like this:
ItemId Price
------- -----
a1 9.8
a1 14.8
a2 7.5
a3 7.0
How can I do this in a efficient way, taking into account that actual dataframes have thousands of rows and many other columns?

ItemIdis a column or the index ?