I have a column
col1
----
a
b
c
a
c
b
I have a mapping like this :
KI13232:a
MK25436:b
SL365487:c
That means, create a new column with name ID
and for all occurrences of a
in the col1
the ID
column value should be KI13232
, same applies to b and c values as well.
The result should look like :
ID col1
---- -----
KI13232 a
MK25436 b
SL365487 c
KI13232 a
SL365487 c
MK25436 b
I have a larger dataset to implement this. What is the optimal method in Pandas to achieve this.