Reputation: 67
I'm trying to remove copyright symbols in my dataframe. I can recognise the symbol using:
symbol = u'\N{COPYRIGHT SIGN}'.encode('utf-8')
symbol = symbol.decode('utf-8')
But when I then try to replace it, this doesn't work:
print(df_one.replace(symbol, ''))
Do I need to read the data in differently somehow? I'm currently using:
df_one = pd.concat(map(pd.read_csv, glob.glob('data/*.csv')))
Upvotes: 1
Views: 278
Reputation: 67
averroes response almost worked. This is the solution I now have that does work:
df.loc[:, "column_name"].replace({symbol: ' '},regex=True)
Upvotes: 1
Reputation: 1113
You should use the "loc" method with the replace function:
df.loc[:, "column_name"].replace({character},regex=True)
Upvotes: 1