Skip to content

Replace _make_aggop with Explicit Aggregation Method Definitions #5307

@ajpotts

Description

@ajpotts

Summary

The internal helper _make_aggop is currently used to dynamically generate aggregation methods (e.g., sum, mean, max, min) on Series and DataFrame. This ticket proposes replacing that mechanism with explicit, statically defined aggregation methods.

Motivation

While _make_aggop reduces code repetition, it introduces several drawbacks:

  • Obscures the public API and makes available methods harder to discover
  • Complicates static analysis, type checking, and IDE support
  • Makes docstring generation and documentation consistency harder to maintain
  • Increases cognitive overhead when tracing behavior during debugging or review

Replacing dynamic method generation with explicit method definitions improves readability, tooling support, and long-term maintainability.

Scope

  • Remove or deprecate _make_aggop in Series and DataFrame
  • Implement explicit aggregation methods (e.g., sum, mean, max, min, prod, etc.)
  • Preserve existing behavior and signatures
  • Ensure docstrings are fully specified and Darglint/mypy compliant
  • Add or update tests to confirm behavioral parity

Non-Goals

  • Changing aggregation semantics or performance
  • Modifying the backend aggregation protocol
  • Introducing new aggregation operations

Acceptance Criteria

  • All aggregation methods previously generated by _make_aggop exist explicitly
  • Public API behavior remains unchanged
  • Documentation and help() output list aggregation methods explicitly
  • Static analysis tools correctly recognize aggregation methods
  • _make_aggop has no remaining callers

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions