Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.6.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ Sparse
ExtensionArray
^^^^^^^^^^^^^^
- Bug in :meth:`Series.mean` overflowing unnecessarily with nullable integers (:issue:`48378`)
- Bug when concatenating an empty DataFrame with an ExtensionDtype to another DataFrame with the same ExtensionDtype, the resulting dtype turned into object (:issue:`48510`)
-

Styler
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/reshape/concat/test_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,11 @@ def test_concat_empty_dataframe_different_dtypes(self):
result = concat([df1[:0], df2[:0]])
assert result["a"].dtype == np.int64
assert result["b"].dtype == np.object_

def test_concat_to_empty_ea(self):
"""48510 `concat` to an empty EA should maintain type EA dtype."""
df_empty = DataFrame({"a": pd.array([], dtype=pd.Int64Dtype())})
df_new = DataFrame({"a": pd.array([1, 2, 3], dtype=pd.Int64Dtype())})
expected = df_new.copy()
result = concat([df_empty, df_new])
tm.assert_frame_equal(result, expected)