Skip to content

BUG: replace hits maximum recursion depth #50657

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

Closed
camold opened this issue Jan 10, 2023 · 4 comments
Closed

BUG: replace hits maximum recursion depth #50657

camold opened this issue Jan 10, 2023 · 4 comments
Labels
Regression Functionality that used to work in a prior pandas version replace replace method
Milestone

Comments

@camold
Copy link

camold commented Jan 10, 2023

import pandas as pd
pd.DataFrame({"foo": [0,1,2]}).replace(0,pd.NA)

crashes by reaching maximum recursion depth.

Interestingly enough a replacement with None instead or numpy.nan works as expected.

Pandas version 1.5.2

@camold camold changed the title replace hits maximum recursion depth BUG: replace hits maximum recursion depth Jan 10, 2023
@phofl
Copy link
Member

phofl commented Jan 10, 2023

Hi, thanks for your report. What you are doing is not a good idea in general, because your data are cast to object. It should work nevertheless though

@phofl phofl added this to the 1.5.3 milestone Jan 10, 2023
@phofl phofl added Regression Functionality that used to work in a prior pandas version replace replace method labels Jan 10, 2023
@dicristina
Copy link
Contributor

This was patched and then the patch was reverted. Issue #45725.

@datapythonista datapythonista modified the milestones: 1.5.3, 1.5.4 Jan 18, 2023
@phofl
Copy link
Member

phofl commented Feb 6, 2023

Not sure why this wasn't closed. This is fixed on 1.5.3 and tests were added

@phofl phofl closed this as completed Feb 6, 2023
@phofl phofl modified the milestones: 1.5.4, 1.5.3 Feb 6, 2023
@phofl
Copy link
Member

phofl commented Feb 6, 2023

Sorry this was incorrect, we decided not to backport because the change was to invasive

@phofl phofl modified the milestones: 1.5.3, 2.0 Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version replace replace method
Projects
None yet
Development

No branches or pull requests

4 participants