I have a dictionary called mapped
{'A=': 0,
'B=': 1,
'C=': 2,
'D=': 3}
and a series called subject
0 [A=4.2, B=402, C=100]
1 [A=4.2, B=399, C=200]
2 [A=FIX.4.2, B=398, C=150]
I want the string instances in my series to be replaced by the value of dictionary in following way
0 [0=4.2, 1=402, 2=100]
1 [0=4.2, 1=399, 2=200]
2 [0=FIX.4.2, 1=398, 2=150]
I tried
subject=subject.replace(mapped_1, regex=True)
df=subject.apply(lambda x : x,mapped)
but I cannot replace inside the strings and python only changes the first instance.