Generation

generate functionTue, 31 Jan 2023

There is a Pandas dataframe: time_on_chart min max performer "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

df.sort_values(['time_on_chart', 'max'], ascending=[False, False]).head(20)

Questions about programming?Chat with your personal AI assistant