Skip to content

Commit ff99f88

Browse files
phoflmroeschke
authored andcommitted
REGR: concat raising for 2 different ea dtypes (pandas-dev#54914)
* REGR: concat raising for 2 different ea dtypes * Update
1 parent 04c7291 commit ff99f88

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

doc/source/whatsnew/v2.1.1.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ including other versions of pandas.
1313

1414
Fixed regressions
1515
~~~~~~~~~~~~~~~~~
16+
- Fixed regression in :func:`concat` when :class:`DataFrame` 's have two different extension dtypes (:issue:`54848`)
1617
- Fixed regression in :func:`merge` when merging over a PyArrow string index (:issue:`54894`)
1718
- Fixed regression in :func:`read_csv` when ``usecols`` is given and ``dtypes`` is a dict for ``engine="python"`` (:issue:`54868`)
1819
- Fixed regression in :func:`read_csv` when ``delim_whitespace`` is True (:issue:`54918`, :issue:`54931`)

pandas/core/internals/concat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def concatenate_managers(
177177
values = np.concatenate(vals, axis=1) # type: ignore[arg-type]
178178
elif is_1d_only_ea_dtype(blk.dtype):
179179
# TODO(EA2D): special-casing not needed with 2D EAs
180-
values = concat_compat(vals, axis=1, ea_compat_axis=True)
180+
values = concat_compat(vals, axis=0, ea_compat_axis=True)
181181
values = ensure_block_shape(values, ndim=2)
182182
else:
183183
values = concat_compat(vals, axis=1)

pandas/tests/reshape/concat/test_concat.py

+9
Original file line numberDiff line numberDiff line change
@@ -858,3 +858,12 @@ def test_concat_multiindex_with_category():
858858
)
859859
expected = expected.set_index(["c1", "c2"])
860860
tm.assert_frame_equal(result, expected)
861+
862+
863+
def test_concat_ea_upcast():
864+
# GH#54848
865+
df1 = DataFrame(["a"], dtype="string")
866+
df2 = DataFrame([1], dtype="Int64")
867+
result = concat([df1, df2])
868+
expected = DataFrame(["a", 1], index=[0, 0])
869+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)