From dc643ed93e17d842f803439735b8d4bf4e0d3a90 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 16 Jul 2021 14:46:14 -0700 Subject: [PATCH] BUG: concat bool+int with ArrayManager --- pandas/core/internals/concat.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 203e48ae48b58..34d0137c26fda 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -123,12 +123,16 @@ def concat_arrays(to_concat: list) -> ArrayLike: # ignore the all-NA proxies to determine the resulting dtype to_concat_no_proxy = [x for x in to_concat if not isinstance(x, NullArrayProxy)] - single_dtype = len({x.dtype for x in to_concat_no_proxy}) == 1 + dtypes = {x.dtype for x in to_concat_no_proxy} + single_dtype = len(dtypes) == 1 - if not single_dtype: - target_dtype = find_common_type([arr.dtype for arr in to_concat_no_proxy]) - else: + if single_dtype: target_dtype = to_concat_no_proxy[0].dtype + elif all(x.kind in ["i", "u", "b"] and isinstance(x, np.dtype) for x in dtypes): + # GH#42092 + target_dtype = np.find_common_type(list(dtypes), []) + else: + target_dtype = find_common_type([arr.dtype for arr in to_concat_no_proxy]) if target_dtype.kind in ["m", "M"]: # for datetimelike use DatetimeArray/TimedeltaArray concatenation