Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
lt = pd.CategoricalDtype(categories=np.asarray([1, 2, 3], dtype="int64"))
rt = pd.CategoricalDtype(categories=np.asarray([1, 2, 3], dtype="float64"))
left = pd.DataFrame({"key": pd.Series([1, 2], dtype=lt)})
right = pd.DataFrame({"key": pd.Series([1, 3], dtype=rt)})
left.merge(right, on="key", how="outer")
Issue Description
[...]
File "<stdin>", line 1, in <module>
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/frame.py", line 10737, in merge
return merge(
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/reshape/merge.py", line 185, in merge
return op.get_result(copy=copy)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/reshape/merge.py", line 897, in get_result
self._maybe_add_join_keys(result, left_indexer, right_indexer)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/reshape/merge.py", line 1076, in _maybe_add_join_keys
key_col = Index(lvals).where(~mask_left, rvals)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 5237, in where
return self.putmask(~cond, other)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 5493, in putmask
return self.astype(dtype).putmask(mask, value)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 5493, in putmask
return self.astype(dtype).putmask(mask, value)
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 5493, in putmask
return self.astype(dtype).putmask(mask, value)
[Previous line repeated 984 more times]
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 1057, in astype
return self.copy() if copy else self
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 1259, in copy
name = self._validate_names(name=name, deep=deep)[0]
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/indexes/base.py", line 1701, in _validate_names
validate_all_hashable(*new_names, error_name=f"{type(self).__name__}.name")
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/dtypes/common.py", line 1575, in validate_all_hashable
if not all(is_hashable(arg) for arg in args):
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/dtypes/common.py", line 1575, in <genexpr>
if not all(is_hashable(arg) for arg in args):
File "/home/wence/Documents/src/rapids/third-party/pandas/pandas/core/dtypes/inference.py", line 366, in is_hashable
hash(obj)
RecursionError: maximum recursion depth exceeded while calling a Python object
Expected Behavior
I would expect this to complete, probably behaving as if the left and right key columns were of type int64 and float64. I would also accept raising.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Expected Behavior
I would expect this to complete, probably behaving as if the left and right key columns were of type int64 and float64. I would also accept raising.
Installed Versions