File tree Expand file tree Collapse file tree 4 files changed +5
-4
lines changed
Expand file tree Collapse file tree 4 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Fixed regressions
1616- Fixed performance regression in :meth: `Series.isin ` when ``values `` is empty (:issue: `49839 `)
1717- Fixed regression in :meth: `DataFrameGroupBy.transform ` when used with ``as_index=False `` (:issue: `49834 `)
1818- Enforced reversion of ``color `` as an alias for ``c `` and ``size `` as an alias for ``s `` in function :meth: `DataFrame.plot.scatter ` (:issue: `49732 `)
19+ - Fixed regression in :meth: `SeriesGroupBy.apply ` setting a ``name `` attribute on the result if the result was a :class: `DataFrame ` (:issue: `49907 `)
1920-
2021
2122.. ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -401,7 +401,8 @@ def _wrap_applied_output(
401401 not_indexed_same = not_indexed_same ,
402402 is_transform = is_transform ,
403403 )
404- result .name = self .obj .name
404+ if isinstance (result , Series ):
405+ result .name = self .obj .name
405406 return result
406407 else :
407408 # GH #6265 #24880
Original file line number Diff line number Diff line change @@ -1177,8 +1177,7 @@ def reset_identity(values):
11771177 result = concat (values , axis = self .axis )
11781178
11791179 name = self .obj .name if self .obj .ndim == 1 else self ._selection
1180- if isinstance (result , Series ) and name is not None :
1181-
1180+ if isinstance (result , Series ) and result .name is None and name is not None :
11821181 result .name = name
11831182
11841183 return result
Original file line number Diff line number Diff line change @@ -334,6 +334,7 @@ def f(piece):
334334 result = grouped .apply (f )
335335
336336 assert isinstance (result , DataFrame )
337+ assert not hasattr (result , "name" )
337338 tm .assert_index_equal (result .index , ts .index )
338339
339340
@@ -1316,7 +1317,6 @@ def test_result_name_when_one_group(name):
13161317 ser = Series ([1 , 2 ], name = name )
13171318 result = ser .groupby (["a" , "a" ], group_keys = False ).apply (lambda x : x )
13181319 expected = Series ([1 , 2 ], name = name )
1319-
13201320 tm .assert_series_equal (result , expected )
13211321
13221322
You can’t perform that action at this time.
0 commit comments