Skip to content

CLN remove unreachable code in pandas/core/groupby/generic.py::DataFrameGroupBy::_wrap_applied_output #33478

Closed
@MarcoGorelli

Description

@MarcoGorelli

NOTE: I'd originally opened a PR to address this, but am now busy with other obligations + other PRs to respond to. So I'm opening it up as a good first issue for now, and will return to work on it if nobody takes it.


In pandas/core/groupby/generic.py::DataFrameGroupBy::_wrap_applied_output, it seems this branch is never reached:

        else:
            # Handle cases like BinGrouper
            return self._concat_objects(keys, values, not_indexed_same=not_indexed_same)

Two things need to be done here:

  1. refactor _wrap_applied_output by making a helper function out of some of its internals (it's currently very long, and changes are hard to review)
  2. Remove this unused else branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefactorInternal refactoring of code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions