Skip to content

Instantly share code, notes, and snippets.

@erap129
Created February 5, 2022 16:56
Show Gist options
  • Save erap129/e12d2884fa4bfea9779f9fb129641ae3 to your computer and use it in GitHub Desktop.
Save erap129/e12d2884fa4bfea9779f9fb129641ae3 to your computer and use it in GitHub Desktop.
rating_by_genre_df = ratings_df.join(movies_df_exploded, on='movie_id').\
groupby('genre').agg({'rating': ['mean', 'count']}).sort_values(('rating', 'mean')).reset_index()
rating_by_genre_df.columns = ['_'.join(col).strip() for col in rating_by_genre_df.columns.values]
px.bar(rating_by_genre_df, x='genre_', y='rating_mean', height=300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment