-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH/GBY: add nlargest/nsmallest to Series.groupby #7356
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
Conversation
maybe add an example in groupby.rst docs (example section?) |
yep |
wonder if df.nlargest('column_name', 3) impl like: def nlargest(self, col, n):
return self.loc[self[col].nlargest(n).index] |
just apply it |
same with value_counts (which FYI is still awaiting impl, but a native one). |
i don't think |
#5381 (not sure why we are not just applying it); though this may be MUCH faster |
you can't really just apply it, tho maybe for multiple columns since it's a partial sort you have to pick a column to sort by, really these methods are more general versions of |
alright i GUESS |
|
I agree if its partially sorted then would be much faster |
Makes a cool pattern
|
my point is that
it uses the last index |
ahh, so it essentially needs a |
it does make sense to keep the index, just like in |
@jreback ok after a doc blurb in groupby.rst and v0.14.1.txt? |
ENH/GBY: add nlargest/nsmallest to Series.groupby
closes #7053