Skip to content

DEPR: GroupBy.dtypes #51045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbrockmendel opened this issue Jan 28, 2023 · 1 comment · Fixed by #51997
Closed

DEPR: GroupBy.dtypes #51045

jbrockmendel opened this issue Jan 28, 2023 · 1 comment · Fixed by #51997
Labels
Deprecate Functionality to remove in pandas Groupby

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Jan 28, 2023

df = pd.DataFrame(
        {
            "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
            "B": ["one", "one", "two", "three", "two", "two", "one", "three"],
            "C": np.random.randn(8),
            "D": np.random.randn(8),
        }
    )

rng = pd.date_range("2014", periods=len(df))
df.columns.name = "foo"
df.index = rng

g = df.groupby(["A"])[["C"]]
g_exp = df[["C"]].groupby(df["A"])

tm.assert_frame_equal(g.dtypes, g_exp.dtypes)

>>> print(g.dtypes)
foo        C
A           
bar  float64
foo  float64

Not clear to me what this is supposed to mean. The example above is from the one test we have (test_groupby_selection_other_methods) that gets here. Shouldn't a user just check df["C"].dtype in this case?

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 28, 2023
@rhshadrach
Copy link
Member

+1 for deprecating.

@rhshadrach rhshadrach added Groupby Deprecate Functionality to remove in pandas and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Groupby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants