dfF:
Sample AlmostFinal
1 KOPLA234
1 KOPLA234
2 RWPLB253
3 MMPLA415
3 MMPLA415
I need to replace KOPL and RWP and MM to KOLPOL and last char a/b should stay. So result shoud be:
Sample AlmostFinal Final
1 KOPLA234 KOLPOLA234
1 KOPLA234 KOLPOLA234
2 RWPLB253 KOLPOLB253
3 MMPLA415 KOLPOLA415
3 MMPLA415 KOLPOLA415
I tried to do it by replace:
dfF['Final'] = (dfF['AlmostFinal'].replace({'KOPL':'KOLPOL'}, regex = True))
dfF['Final'] = (dfF['AlmostFinal'].replace({'RWP':'KOLPOL'}, regex = True))
dfF['Final'] = (dfF['AlmostFinal'].replace({'MMPL':'KOLPOL'}, regex = True))
And: If i comment 2th and 3th line replaces for KOPL works.
When I comment 1st and 3th replace for RWP works.
But when I uncomment all and try to run all 3 lines works only last. Why? In another script I have a similar code and it changes whole while and whole lines works.