Skip to content

Commit 28b45f2

Browse files
committed
BUG: GH23227 Fixed
1 parent 27ce828 commit 28b45f2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def _try_cast(self, result, obj, numeric_only=False):
759759
else:
760760
dtype = obj.dtype
761761

762-
if is_extension_array_dtype(obj.dtype):
762+
if is_extension_array_dtype(dtype):
763763
# The function can return something of any type, so check
764764
# if the type is compatible with the calling EA.
765765
try:

pandas/tests/groupby/test_grouping.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ def test_groupby_categorical_index_and_columns(self, observed):
283283
assert_frame_equal(result, expected)
284284

285285
def test_groupby_extension_array(self):
286+
287+
# GH23227
288+
# groupby on an extension array should return the extension array type
286289
df = pd.DataFrame({'Int': pd.Series([1, 2, 3], dtype='Int64'),
287290
'A': [1, 2, 1]})
288291
result = df.groupby('A').Int.sum()

0 commit comments

Comments
 (0)