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
from datetime import date
import pandas as pd
mi_a = pd.MultiIndex.from_tuples([(date(2001, 1, 1), "foo")], names=["first", "second"])
mi_b = pd.MultiIndex.from_tuples([(pd.Timestamp(date(2001, 1, 1)), "asdf")], names=["first", "second"])
mi_a.union(mi_b)
Issue Description
The following exception is thrown:
InvalidIndexError Traceback (most recent call last)
...
InvalidIndexError: Reindexing only valid with uniquely valued Index objects
Expected Behavior
I would have expected the two values date(2001, 1, 1)
and pd.Timestamp(date(2001, 1, 1))
to be treated as different values, which is how I believe pd.DataFrame.drop_duplicates
acts. However treating the two values as identical could also be valid, but I don't think that the exception is.
Installed Versions
INSTALLED VERSIONS
commit : c888af6
python : 3.13.5
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252
pandas : 2.3.1
numpy : 2.3.1
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.0
Cython : None
sphinx : None
IPython : 8.37.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.4
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.6
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None