Retrieve rows of a Python Pandas data frame with the 6 largest values of column x:
df.sort_values('x').tail(6)
Even better:
df.nlargest(n=6, columns='x')
Why is it better? On a 3m row, 680 MB data frame, sort/tail took 622 ms. nlargest? Only 84 ms — 7x faster!
