Skip to content

ENH: Add indexing syntax to GroupBy.nth() #44688

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 20 commits into from
Dec 4, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update test_nth.py
  • Loading branch information
johnzangwill committed Nov 30, 2021
commit 55fee64dbdac304c9a8f0967ce60fe09f74fdc08
9 changes: 9 additions & 0 deletions pandas/tests/groupby/test_nth.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,15 @@ def test_slice(slice_test_df, slice_test_grouped, arg, expected_rows):
tm.assert_frame_equal(result, expected)


def test_nth_indexed(slice_test_df, slice_test_grouped):
# Test index notation GH #44688

result = slice_test_grouped.nth[0, 1, -2:]
expected = slice_test_df.iloc[[0, 1, 2, 3, 4, 6, 7]]

tm.assert_frame_equal(result, expected)


def test_invalid_argument(slice_test_grouped):
# Test for error on invalid argument

Expand Down