Remove Dollar Sign from Entire Python Pandas Dataframe

前端 未结 1 1596
失恋的感觉
失恋的感觉 2021-01-06 08:56

I\'m looking to remove dollar signs from an entire python pandas dataframe. It\'s similar to this post:

Remove Entire Character

However, I\'m looking to remo

相关标签:
1条回答
  • 2021-01-06 09:20

    You need escape $ by \:

    dftest[colstocheck] = dftest[colstocheck].replace({'\$':''}, regex = True)
    print (dftest)
       A  B        C    D  E  F
    0  1  4       f;   s%  5  7
    1  2  5       d:   d;  3  4
    2  3  6  sda%;sd  d;p  6  3
    
    0 讨论(0)
提交回复
热议问题