kieferk / dfply

dplyr-style piping operations for pandas dataframes
GNU General Public License v3.0
889 stars 103 forks source link

Add top n #12

Closed bleearmstrong closed 7 years ago

bleearmstrong commented 7 years ago

Adds top_n functionality. eg. df >> top_n(X.x, n=5 [,ascending=True]) n must be specified; like dplyr, if no column is specified, then the last column is used as a default May return more than n in the case of ties

bleearmstrong commented 7 years ago

There was a python2/3 compatibility issue with how parameters are passed. col is now a keyword (still defaults to the last column)

usage is now like df >> top_n(col=X.x, n=5)

kieferk commented 7 years ago

Cool thank you. Merging into develop.