BUG: pd.Index.Intersection fails with multiple data frames #58818
Labels
Bug
Closing Candidate
May be closeable, needs more eyeballs
Index
Related to the Index class or subclasses
setops
union, intersection, difference, symmetric_difference
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
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1534, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/GeorgesKanaan/Documents/Development/Methylation/willis_dmr_analysis.py", line 158, in
common_index = df1.index.intersection([df1.index, df2.index, df3.index])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3532, in intersection
result = self._intersection(other, sort=sort)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3561, in _intersection
res_values = self._intersection_via_get_indexer(other, sort=sort)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3582, in _intersection_via_get_indexer
right_unique = other.unique()
^^^^^^^^^^^^^^
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3065, in unique
if self.is_unique:
^^^^^^^^^^^^^^
File "properties.pyx", line 36, in pandas._libs.properties.CachedProperty.get
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 2346, in is_unique
return self._engine.is_unique
^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 266, in pandas._libs.index.IndexEngine.is_unique.get
File "index.pyx", line 271, in pandas._libs.index.IndexEngine._do_unique_check
File "index.pyx", line 333, in pandas._libs.index.IndexEngine._ensure_mapping_populated
File "pandas/_libs/hashtable_class_helper.pxi", line 7115, in pandas._libs.hashtable.PyObjectHashTable.map_locations
TypeError: unhashable type: 'Index'
The text was updated successfully, but these errors were encountered: