Generation

generate functionWed, 01 Feb 2023

There is a Pandas dataframe: performer time_on_chart min max "Groove" Holmes 1 11 "Little" Jimmy Dickens 1 10 "Pookie" Hudson 1 1 "Weird Al" Yankovic 1 20 Sort these rows by the time_on_chart and max columns, in descending order, and display the first 20 rows

import pandas as pd df = pd.read_csv("https://www.dropbox.com/s/jr9c7rwhi8hvuk7/performers.csv?dl=1") df.sort_values(by=['time_on_chart','max'], ascending=False).head(20) performer min max time_on_chart 9 "Weird Al" Yankovic 1 20 21 0 "Groove" Holmes 1 11 12 1 "Little" Jimmy Dickens 1 10 11 2 "Pookie" Hudson 1 1 2

Questions about programming?Chat with your personal AI assistant