I have the following data:
print(df):
Name
James (C)
Mick
Tash (C)
Liv
Nathan
Chris
I am simply trying to get
print(df):
James
Mick
Tash
Liv
Nathan
Chris
I have tried:
df['Name'] = df['Name'].str.replace(' (C)','')
Which does nothing. and then i also try:
df['Name'] = df['Name'].replace({'(C)': ''}, inplace=True)
Which clears the whole column on output.
Then I tried:
df['Name'] = df['Name'].str.replace("[(C)]", "")
Which works but it removes any C eg Chris becomes hris
I have looked and these are the main options but they all don't quite work?