python3 -c 'import pandas as pd; df=pd.read_csv("data.csv"); print(df.sort_values("salary", ascending=False).head(3))'
Sort pandas rows by salary and show the top 3
sort_values orders the DataFrame by the salary column, ascending=False puts the largest first, and head(3) keeps the top three rows. This is the pandas recipe for a top-N ranking. The default ascending=True gives the smallest values first. Chain reset_index() if you need fresh row indices after sorting.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.