replace method does't work with string type Series · Issue #31644 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

pd.Series(['A','B']).replace(r'.','C',regex=True) 0 C 1 C dtype: object pd.Series(['A','B']).astype('string').replace(r'.','C',regex=True) 0 A 1 B dtype: string

Problem description

It seems that replace doesn't work with the string type Series.
Why these two codes return different results?