Exercise

Best-selling movie by location

With our new tools, we can create even more useful tables. Recall earlier, when we found the best-selling movie in Portland - we had to filter our table for Portland films only, then sort the values to find our best-seller. It would be pretty time consuming to do this for every theater location.

Instead, using some of our new tools, we can quickly condense our sales transaction data down to a summary table, sort that summary table, and get the top movie for each market all at once.

Instructions

100 XP
  • Use .groupby() and .sum() to create a summary table by theater_location and movie_title.
  • Sort totals by ticket_quantity in descending order.
  • Use .groupby() and .head() to extract the top movie by theater_location.
  • Print top_movies.