BUG: drop_duplicates() inconsistent output when using/not using subset and having different types of NaNs #59887
Labels
Bug
Needs Discussion
Requires discussion from core team before further action
PDEP missing values
Issues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint
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
Hi,
I have the following pandas DataFrame:
With
I get:
But when using the parameter
subset
for the only column that has a difference,I get:
I have two questions:
pandas.NaT
andfloat('nan')
are considered as different values bydrop_duplicates()
?Thank you!
Expected Behavior
I expected that the outcome would be the same in both cases.
Installed Versions
INSTALLED VERSIONS
commit : a671b5a
python : 3.10.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 167 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : English_United States.1253
pandas : 2.1.4
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.2.2
pip : 23.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : 5.0.2
blosc : None
feather : None
xlsxwriter : 3.1.9
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.20.0
pandas_datareader : None
bs4 : 4.12.2
bottleneck : 1.3.7
dataframe-api-compat: None
fastparquet : None
fsspec : 2024.3.1
gcsfs : None
matplotlib : 3.8.4
numba : 0.59.0
numexpr : 2.8.7
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 14.0.2
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.3
sqlalchemy : None
tables : 3.9.2
tabulate : 0.9.0
xarray : 2024.2.0
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : 2.4.1
pyqt5 : None
The text was updated successfully, but these errors were encountered: