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.5.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Fixed regressions
- Fixed performance regression in :meth:`Series.isin` when ``values`` is empty (:issue:`49839`)
- Fixed regression in :meth:`DataFrameGroupBy.transform` when used with ``as_index=False`` (:issue:`49834`)
- Enforced reversion of ``color`` as an alias for ``c`` and ``size`` as an alias for ``s`` in function :meth:`DataFrame.plot.scatter` (:issue:`49732`)
- Fixed regression in :meth:`SeriesGroupBy.apply` setting a ``name`` attribute on the result if the result was a :class:`DataFrame` (:issue:`49907`)
-

.. ---------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ def _wrap_applied_output(
not_indexed_same=not_indexed_same,
override_group_keys=override_group_keys,
)
result.name = self.obj.name
if isinstance(result, Series):
result.name = self.obj.name
return result
else:
# GH #6265 #24880
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def f(piece):
result = grouped.apply(f)

assert isinstance(result, DataFrame)
assert not hasattr(result, "name") # GH49907
tm.assert_index_equal(result.index, ts.index)


Expand Down