We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
import numpy as np import pandas as pd x = pd.DataFrame([np.nan]) np.nan_to_num(x, copy=True) print(x)
Result x is changed to 0.0 even when nan_to_num is called with copy=True.
This issue is originally reported to numpy here. Looks like pandas ignores copy=True NumPy passes?
copy=True
x should not be changed when copy=True.
commit : 0691c5c python : 3.11.8 python-bits : 64 OS : Linux OS-release : 5.10.0-smp-1100.466.602.1 Version : #1 [v5.10.0-1100.466.602.1] SMP @1708156698 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : None LOCALE : en_US.UTF-8
pandas : 2.2.3 numpy : 2.1.1 pytz : 2024.1 dateutil : 2.8.1 pip : None Cython : None sphinx : None IPython : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None blosc : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None html5lib : None hypothesis : None gcsfs : None jinja2 : None lxml.etree : 5.3.0 matplotlib : None numba : None numexpr : 2.8.7 odfpy : None openpyxl : 3.1.2 pandas_gbq : None psycopg2 : None pymysql : None pyarrow : None pyreadstat : None pytest : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.13.1 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : 2.0.1 xlsxwriter : None zstandard : None tzdata : None qtpy : None pyqt5 : None
The text was updated successfully, but these errors were encountered:
Thanks, this seems to be related to #57739
Sorry, something went wrong.
This issue no longer exists on the main branch as of 2a10e04. The script returns:
0 0 NaN
This issue no longer exists on the main branch as of 2a10e04. The script returns: 0 0 NaN
I saw in one of your edits that you have numpy 1.26.4 This issue only should only occur with numpy 2.0+
I see. Sorry for the noise.
__array__
Successfully merging a pull request may close this issue.
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
Result x is changed to 0.0 even when nan_to_num is called with copy=True.
This issue is originally reported to numpy here. Looks like pandas ignores
copy=True
NumPy passes?Expected Behavior
x should not be changed when copy=True.
Installed Versions
INSTALLED VERSIONS
commit : 0691c5c
python : 3.11.8
python-bits : 64
OS : Linux
OS-release : 5.10.0-smp-1100.466.602.1
Version : #1 [v5.10.0-1100.466.602.1] SMP @1708156698
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8
pandas : 2.2.3
numpy : 2.1.1
pytz : 2024.1
dateutil : 2.8.1
pip : None
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : 5.3.0
matplotlib : None
numba : None
numexpr : 2.8.7
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.13.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlsxwriter : None
zstandard : None
tzdata : None
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: