Skip to content

Conversation

ofsouzap
Copy link
Contributor

@ofsouzap ofsouzap commented Nov 9, 2024

xref #55178

@ofsouzap ofsouzap requested a review from rhshadrach as a code owner November 9, 2024 17:06
@chanshing
Copy link
Contributor

It appears that DataFrameGroupBy and SeriesGroupBy are not top-level classes/functions:

[ins] In [1]: import pandas as pd

[ins] In [2]: pd.NamedAgg
Out[2]: pandas.core.groupby.generic.NamedAgg

[ins] In [3]: pd.SeriesGroupBy
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 pd.SeriesGroupBy

AttributeError: module 'pandas' has no attribute 'SeriesGroupBy'

[ins] In [4]: pd.DataFrameGroupBy
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[4], line 1
----> 1 pd.DataFrameGroupBy

AttributeError: module 'pandas' has no attribute 'DataFrameGroupBy'

@simonjayhawkins simonjayhawkins added Output-Formatting __repr__ of pandas objects, to_string Sprints Sprint Pull Requests labels Nov 9, 2024
@simonjayhawkins simonjayhawkins added this to the 3.0 milestone Nov 9, 2024
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ofsouzap

@rhshadrach
Copy link
Member

It appears that DataFrameGroupBy and SeriesGroupBy are not top-level classes/functions:

Correct, they are exposed in pandas.api.typing as they should not be instantiated by users directly. This is the path that __module__ should be set to.

@ofsouzap
Copy link
Contributor Author

It appears that DataFrameGroupBy and SeriesGroupBy are not top-level classes/functions:

Correct, they are exposed in pandas.api.typing as they should not be instantiated by users directly. This is the path that __module__ should be set to.

Thanks, I'll work on getting this implemented

@jorisvandenbossche jorisvandenbossche changed the title decorate pandas.core.groupby.generic classes with @set_module('pandas') ENH: set __module__ on NamedAgg / SeriesGroupBy / DataFrameGroupBy (pandas.core.groupby.generic classes) Nov 11, 2024
@simonjayhawkins
Copy link
Member

Thanks @ofsouzap for the updates.

Because of merging some of the related PRs, there is now a merge conflict in the tests file. Could you merge the latest main to resolve that conflict? (and let us know if you need any help with that)

@simonjayhawkins simonjayhawkins merged commit a11fd2e into pandas-dev:main Nov 11, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Output-Formatting __repr__ of pandas objects, to_string Sprints Sprint Pull Requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants