Skip to content
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: replace with regex raising for StringDType #41343

Merged
merged 3 commits into from
May 11, 2021

Conversation

mzeitlin11
Copy link
Member

2 separate issues at play here - regex was ignored in #41333 (specific to the replace_list path) but then if replace_regex was hit with anything but an object type that would just raise.

@mzeitlin11 mzeitlin11 added Bug replace replace method Strings String extension data type and string data labels May 6, 2021
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mzeitlin11 generally lgtm for the fix in hand, although we should probably be dispatching to the _str_replace method on the EA.

@simonjayhawkins simonjayhawkins added this to the 1.3 milestone May 9, 2021
@simonjayhawkins simonjayhawkins added the ExtensionArray Extending pandas with custom dtypes or arrays. label May 9, 2021
@mzeitlin11
Copy link
Member Author

Thanks @mzeitlin11 generally lgtm for the fix in hand, although we should probably be dispatching to the _str_replace method on the EA.

Agreed, but I think that decision could be handled independently of fixing this. There's some additional complexity because I think _str_replace assumes replacement occurs with a string, which is not guaranteed by the general replace function (though it would be a strange thing to do).

@simonjayhawkins
Copy link
Member

Agreed, but I think that decision could be handled independently of fixing this.

sure.

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending green

@jreback jreback merged commit b472080 into pandas-dev:master May 11, 2021
@jreback
Copy link
Contributor

jreback commented May 11, 2021

thanks @mzeitlin11 very nice!

@mzeitlin11 mzeitlin11 deleted the stringdtype_regex_replace branch May 11, 2021 20:27
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays. replace replace method Strings String extension data type and string data
Projects
None yet
3 participants