pandas.DataFrame.nlargest — pandas 0.18.1 documentation (original) (raw)

Get the rows of a DataFrame sorted by the n largest values of columns.

New in version 0.17.0.

df = DataFrame({'a': [1, 10, 8, 11, -1], ... 'b': list('abdce'), ... 'c': [1.0, 2.0, np.nan, 3.0, 4.0]}) df.nlargest(3, 'a') a b c 3 11 c 3 1 10 b 2 2 8 d NaN