ComeçarComece de graça

Summarizing and sorting values

We can take what we've learned so far to create tables that give us informative views into our data.

Through grouping and summing, we can condense our data down to the features we really care about. Then with methods like .sort_values(), we can order that data to learn more.

Let's get a better look at what movie_genres are yielding the highest ticket sales.

Este exercício faz parte do curso

Python for Spreadsheet Users

Ver curso

Instruções do exercício

  • Use .groupby() and .sum() to create a summary table by movie_genre.
  • Use .sort_values() and the proper arguments to sort by ticket_quantity in descending order.
  • Print genres_sorted.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Create a summary by movie genre 
genre_summary = sales.____(____,as_index=False).____()

# Sort summary in descending order of tickets sold
genres_sorted = genre_summary.____(____, ____).reset_index(drop=True)

# Print the sorted summary
Editar e executar o código