Skip to content

DataFrameGroupBy attribute access for columns #439

@rhshadrach

Description

@rhshadrach

Describe the bug
When accessing a column on a DataFrameGroupBy object via attribute-access (see below), mypy complains that no such attribute exists.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
  2. Indicate which type checker you are using (mypy or pyright).
  3. Show the error message received from that type checker while checking your example.
df = pd.DataFrame({'a': [1, 1, 2], 'b': [3, 4, 5]})
gb = df.groupby('a').b

mypy 0.991 says: "_DataFrameGroupByNonScalar" has no attribute "b"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions