Skip to content

Commit 70b105b

Browse files
jbrockmendelfeefladder
authored andcommitted
BUG: concat bool+int with ArrayManager (pandas-dev#42576)
1 parent 060c376 commit 70b105b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pandas/core/internals/concat.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,16 @@ def concat_arrays(to_concat: list) -> ArrayLike:
123123
# ignore the all-NA proxies to determine the resulting dtype
124124
to_concat_no_proxy = [x for x in to_concat if not isinstance(x, NullArrayProxy)]
125125

126-
single_dtype = len({x.dtype for x in to_concat_no_proxy}) == 1
126+
dtypes = {x.dtype for x in to_concat_no_proxy}
127+
single_dtype = len(dtypes) == 1
127128

128-
if not single_dtype:
129-
target_dtype = find_common_type([arr.dtype for arr in to_concat_no_proxy])
130-
else:
129+
if single_dtype:
131130
target_dtype = to_concat_no_proxy[0].dtype
131+
elif all(x.kind in ["i", "u", "b"] and isinstance(x, np.dtype) for x in dtypes):
132+
# GH#42092
133+
target_dtype = np.find_common_type(list(dtypes), [])
134+
else:
135+
target_dtype = find_common_type([arr.dtype for arr in to_concat_no_proxy])
132136

133137
if target_dtype.kind in ["m", "M"]:
134138
# for datetimelike use DatetimeArray/TimedeltaArray concatenation

0 commit comments

Comments
 (0)