Skip to content
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

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

Merged
merged 20 commits into from
Dec 4, 2021

Conversation

johnzangwill
Copy link
Contributor

Add index notation to nth for lists of integers and slices

@johnzangwill johnzangwill changed the title Nth indexer ENH: Nth indexer Nov 30, 2021
@johnzangwill johnzangwill changed the title ENH: Nth indexer ENH: add indexing syntax to GroupBy.nth() Nov 30, 2021
@johnzangwill johnzangwill changed the title ENH: add indexing syntax to GroupBy.nth() ENH: Add indexing syntax to GroupBy.nth() Nov 30, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

i like it. some small commments.

@@ -902,6 +905,15 @@ def __getattr__(self, attr: str):
f"'{type(self).__name__}' object has no attribute '{attr}'"
)

def __getattribute__(self, attr):
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 type args & outputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typed the arg, but the output has no type

pandas/tests/groupby/test_nth.py Show resolved Hide resolved
@jreback jreback added this to the 1.4 milestone Dec 3, 2021
@jreback jreback added API - Consistency Internal Consistency of API/Behavior Groupby labels Dec 3, 2021
@pep8speaks
Copy link

pep8speaks commented Dec 4, 2021

Hello @johnzangwill! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-12-04 16:01:30 UTC

@jreback jreback merged commit 3e7c2f6 into pandas-dev:master Dec 4, 2021
@jreback
Copy link
Contributor

jreback commented Dec 4, 2021

thanks @johnzangwill very nice

@johnzangwill johnzangwill deleted the Nth_Indexer branch December 5, 2021 08:43
@emilmirzayev
Copy link

Hi. Is this already implemented into pandas? I have a use case with groupby slice which is similar to this. Thank you!

@johnzangwill
Copy link
Contributor Author

Hi. Is this already implemented into pandas? I have a use case with groupby slice which is similar to this. Thank you!

@emilmirzayev This has been merged to master for release in 1.4, which was scheduled for December 31 2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: add indexing syntax to GroupBy.nth()
4 participants