Skip to content

TST : add test for groupby aggregation dtype #43915

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

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pandas/tests/groupby/aggregate/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,16 @@ def func(ser):
tm.assert_frame_equal(res, expected)


def test_groupby_aggregate_directory():
Copy link
Contributor

Choose a reason for hiding this comment

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

can you parameterize over of the reduction kernels (use reduction_func)
and parameterize using frame_or_series

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thanks for the review.
I add reduction_func parameters and I try with frame_or_series parameter but it's seems that using a dictionary on a series for aggregation raise a "nested renamer is not supported" (seems deprecated in #15931 but now raise error).
Say me if I miss something (it's my first contribution).

# GH#32793
df = DataFrame([[0, 1], [0, np.nan]]).convert_dtypes()
df_agg_last = df.groupby(0).agg("last")
df_agg_last_dir = df.groupby(0).agg({1: "last"})

tm.assert_frame_equal(df_agg_last, df_agg_last_dir)
tm.assert_series_equal(df_agg_last.dtypes, df_agg_last_dir.dtypes)


def test_group_mean_timedelta_nat():
# GH43132
data = Series(["1 day", "3 days", "NaT"], dtype="timedelta64[ns]")
Expand Down