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
Comment From: phofl
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
Comment From: dicristina
This was patched and then the patch was reverted. Issue #45725.
Comment From: phofl
Not sure why this wasn't closed. This is fixed on 1.5.3 and tests were added
Comment From: phofl
Sorry this was incorrect, we decided not to backport because the change was to invasive