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: Fix ValueError in DataFrame/Series regex replace for all-NA values #60691

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

snitish
Copy link
Member

@snitish snitish commented Jan 10, 2025

In case of all-NA values, pandas.core.array_algos.replace.compare_or_regex_search throws a ValueError as it calls np.vectorize without specifying otypes. Specifying otypes lets np.vectorize work with empty arrays.

@mroeschke mroeschke added the replace replace method label Jan 10, 2025
@mroeschke mroeschke added this to the 3.0 milestone Jan 10, 2025
@mroeschke mroeschke merged commit 8f9039d into pandas-dev:main Jan 10, 2025
55 checks passed
@mroeschke
Copy link
Member

Thanks @snitish

@snitish snitish deleted the issue60688 branch February 6, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
replace replace method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: ValueError in pandas.DataFrame.replace with regex on single-row DataFrame with None/NaN
2 participants