user12904074
user12904074

Reputation:

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'')

Upvotes: 3

Views: 898

Answers (1)

jezrael
jezrael

Reputation: 863301

I think you need regex=True for substrings replacement:

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

Upvotes: 3

Related Questions