Home > Enterprise >  Replace \x00\x00\x00 to empty in a dataframe
Replace \x00\x00\x00 to empty in a dataframe

Time:04-12

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?

CodePudding user response:

Would this work ?

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