I have the following DataFrame:
df = pd.DataFrame(index=['A','B','C'], columns=['x','y'])
x y
A NaN NaN
B NaN NaN
C NaN NaN
I need to update column 'x' based on matching the index value to the following dictionary:
my_dict = {'A': "map_1", 'B': "map_2", "c": "map_3"}
So, the end result should be;
x y
A map_1 NaN
B map_2 NaN
C map_3 NaN
I know how to use the map function if I was comparing another column, but I need to compare the index.