pandas replace (erase) different characters from strings

后端 未结 3 1234
灰色年华
灰色年华 2020-12-09 21:52

I have a list of high schools. I would like to erase certain characters, words, and symbols from the strings.

I currently have:

df[\'schoolname\'] =          


        
3条回答
  •  清歌不尽
    2020-12-09 22:36

    Use regex (seperate the strings by |):

    df['schoolname'] = df['schoolname'].str.replace('high|school', "")
    

提交回复
热议问题