duolanierduone
duolanierduone

Reputation: 157

Replace \x00\x00\x00 to empty in a dataframe

I have one dataframe, there is one column, some rows contain '\x00\x00\x00'. I'd like to replace to empty. My code is like this:

df.loc[df['column1']=='\x00\x00\x00','column1'] = ''

After that, when print this column, it's still same, no changes.

Any suggestion?

Upvotes: 0

Views: 884

Answers (1)

Daniel Weigel
Daniel Weigel

Reputation: 1137

Would this work ?

df['column1']=df['column1'].str.replace('\x00\x00\x00','')

Upvotes: 1

Related Questions