-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DataFrame.replace fails to replace value when column contains pd.NA #47480
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
Comments
Hi, thanks for your report. Did you check on 1.4.2 and main? Because this works on both for me. |
might need tests |
Hi @phofl. I tried replicating the issue in 1.4.3 on my local machine and I got the following error:
What versions do you use in your own environment? I'd be curious to know since you say it works fine for you. Mine are: INSTALLED VERSIONScommit : e8093ba pandas : 1.4.3 |
Hmm good point, does not work on 1.4.2, but on main |
Hi there, |
Hi @phofl, I have similar error as as @johnmantios , the issue seem to be coming even from 1.4.3 as well. The issue is being thrown on line 100 here of ..\pandas\core\missing.py. There are no accessible definition for to_numpy based on any of the imports. |
I tried solving this issue by overloading the comparation operator |
NA = NA is again NA, this happens on purpose |
Is anybody working on this ? Can I investigate ? |
Just out of curiosity may I ask why? @phofl |
https://en.m.wikipedia.org/wiki/Three-valued_logic Kleene logic |
Thank you so much!
…On Mon, 8 Aug 2022, 1:36 pm Patrick Hoefler, ***@***.***> wrote:
https://en.m.wikipedia.org/wiki/Three-valued_logic
Kleene logic
—
Reply to this email directly, view it on GitHub
<#47480 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWI7Q4YTNTVMBUCE6XAYK2LVYFVTZANCNFSM5ZSRIGKA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Works on main
returns
|
I would like to take this. @phofl |
Hi @phofl , If the issue still exists can I pick this up? |
I just did use your reproducible example and it just works fine for me. I guess you can mark this issue as closed as this is probably fixed by now. But please let me know if you continue having the issue, because I´m interested in helping! |
We try to add tests if something was fixed without getting closed |
take |
Tested using the Docker image and the bug still exists. It seems to happen only when From what I found, the problem is at the function
In this situation Should I send pull request with failing tests? |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Pandas replace function does not seem to work on a column if the column contains at least one pd.NA value
Expected Behavior
replace function should work even if pd.NA values are in the column
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.10.0.final.0
python-bits : 64
OS : Linux
OS-release : 5.16.19-76051619-generic
Version : #202204081339
164969616120.04091f44bdev-Ubuntu SMP PREEMPT Tumachine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.21.2
pytz : 2021.3
dateutil : 2.8.2
pip : 21.2.4
setuptools : 58.0.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.2
IPython : 7.29.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.5.1
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: