diff --git a/pandas/core/reshape/merge.py b/pandas/core/reshape/merge.py index 50aaac211c7a5..1a5e7177ddea0 100644 --- a/pandas/core/reshape/merge.py +++ b/pandas/core/reshape/merge.py @@ -966,16 +966,11 @@ def _maybe_add_join_keys( # if we have an all missing left_indexer # make sure to just use the right values or vice-versa mask_left = left_indexer == -1 - mask_right = right_indexer == -1 # error: Item "bool" of "Union[Any, bool]" has no attribute "all" if mask_left.all(): # type: ignore[union-attr] key_col = Index(rvals) result_dtype = rvals.dtype - # error: Item "bool" of "Union[Any, bool]" has no attribute "all" - elif ( - right_indexer is not None - and mask_right.all() # type: ignore[union-attr] - ): + elif right_indexer is not None and (right_indexer == -1).all(): key_col = Index(lvals) result_dtype = lvals.dtype else: