Removing b'' from string column in a pandas dataframe

前端 未结 2 1288
一向
一向 2021-01-18 03:21

I have a data frame as taken from SDSS database. Example data is here.

I want to remove the character \'b\' from data[\'class\']. I tried

2条回答
  •  天涯浪人
    2021-01-18 03:56

    You're working with byte strings. You might consider str.decode:

    data['class'] = data['class'].str.decode('utf-8') 
    

提交回复
热议问题