replace method with comma separator does not work in pandas 0.24.1 · Issue #25259 · pandas-dev/pandas (original) (raw)

The latest version (0.24.1) does not replace comma separator, but 0.23.4 does.

import pandas as pd

df = pd.DataFrame({'one': ["1,000", "2,000"], 'two': ["3,000", "4,000"]}) df = df.replace({',': ''}, regex=True)

print(pd.version) print(df)

0.23.4
    one   two
0  1000  3000
1  2000  4000
0.24.1
     one    two
0  1,000  3,000
1  2,000  4,000

If other characters are used with a comma, it works normally

df = df.replace({'1,': ''}, regex=True)
     one    two
0    000  3,000
1  2,000  4,000