-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: replacement works for object but not string dtype #35977
Comments
This comment has been minimized.
This comment has been minimized.
@yunkypunky Thanks for the report. This could be a real bug (haven't looked too closely yet) so I think it's worth leaving open for now. |
I'm using Python 3.8.5 with Pandas 1.1.1 |
This bug is coming because ExtensionBlock doesn't support replacement by regex. In [5]: is_extension_array_dtype(pd.Series(["d","d","f"],dtype='object').dtype) |
@cgangwar11 Agreed that extension dtypes should also support replacement with a regex, PR would be welcome |
since [09e2036] DEPR: CategoricalBlock; combine Block.replace methods (#40527) this no longer silently fails
|
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
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]The text was updated successfully, but these errors were encountered: