If the last letter contains number 5 then I want to replace it with 0.
id PA005 and XP095 contain 5 at the last I want to replace 5 to 0.
In a similar fashion, if the second letter contains A then replace it with Z. ID Ba002, CA003 and Pa005 contains the second letter A and i want to replace it to Z
Below is the dataframe:
Expand|Select|Wrap|Line Numbers
- data = {'id': ['BP001', ' Ba002', 'CA003', 'EF004', 'Pa005','EP001','EM050','XP095']}
- df = pd.DataFrame(data, columns = ['id'])
- df
Appreciate your help.