Description
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
import numpy as np
import pandas as pd
x = pd.DataFrame([np.nan])
np.nan_to_num(x, copy=True)
print(x)
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