# Sorting by frequency df_sorted = df.sort_values(by='Frequency Rank')