Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how remove /xa0 from pandas dictionary?

I have a csv file. I read and made a dictionary with its columns. but in dictionary I have a lot of /xa0 how I can remove them?

data=pd.read_csv('A.csv')
data.dropna(inplace=True)
Title = data['FIRST'].str.lower()
Abbr = data['1ST'].str.lower()
JobAbbreviation=dict(zip(Abbr, Title))

I tried the following but it doesn't work.

data = data.replace(u'\xa0', u'')

1 Answers

I think you need regex=True for substrings replacement:

data = data.replace(u'\xa0', u'', regex=True)
like image 139
jezrael Avatar answered Nov 22 '25 14:11

jezrael