Aan de slagGa gratis aan de slag

Best genres

Let's make another graphic, this time with movie genres instead.

Once again, here are the lines of code we used to summarize our sales data into genre_totals before graphing.

(scroll to the right to see more)

genre_totals = sales.groupby('movie_genre', as_index=False).sum()

genre_totals = genre_totals.sort_values('revenue', ascending=False).reset_index(drop=True)

Deze oefening maakt deel uit van de cursus

Python for Spreadsheet Users

Cursus bekijken

Oefeninstructies

  • Use sns.barplot() to create a graph of genre_totals with movie_genre on the x axis and revenue on the y-axis.
  • Display the plot.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

import seaborn as sns
import matplotlib.pyplot as plt

# Create barplot


# Display barplot
Code bewerken en uitvoeren