Skip to content

replace method with comma separator does not work in pandas 0.24.1 #25259

Closed
@mr-yoo

Description

@mr-yoo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugRegressionFunctionality that used to work in a prior pandas versionStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions