-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysStringsString extension data type and string dataString extension data type and string datareplacereplace methodreplace method
Milestone
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample
import pandas as pd import numpy as np a = pd.DataFrame({'a': ['a', 'b', 'c'], 'b': ['d', '', '']}, dtype='object') b = pd.DataFrame({'a': ['a', 'b', 'c'], 'b': ['d', '', '']}, dtype='string') print(a) a.replace(r'^\s*$', pd.NA, regex=True, inplace=True) print(a) print(b) b.replace(r'^\s*$', pd.NA, regex=True, inplace=True) print(b)Problem description
replace(r'^\s*$', pd.NA, regex=True, inplace=True) works on object dtype, but not on stringdtype
Expected Output
Same on both replacement
Output of pd.show_versions()
[paste the output of pd.show_versions() here leaving a blank line after the details tag]
camilogutierrez
Metadata
Metadata
Assignees
Labels
BugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysStringsString extension data type and string dataString extension data type and string datareplacereplace methodreplace method