This is an example of the file I have,
Name Att1 Att2 Att3
AB_EN 1 2 3
CD 5 6 7
FG_EN 7 8 9
So, in the column 'Name', where '_EN' is present, I want to remove the '_EN' part. The output should be as follows:
Name Att1 Att2 Att3
AB 1 2 3
CD 5 6 7
FG 7 8 9
This is what I was trying:
name = df['Name']
for entry in name:
if "_EN" in entry:
entry = entry.split('_')[0]
However, this is not working. What is a good way to do this?