BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 2: Data Analytics/Group & Aggregate1/3
Exercise·7 min·10 XP

Average Rating per Genre

Context. A reviews site wants the average rating for each movie genre.

Your task. Write avg_rating_per_genre(df) that returns a Series indexed by genre, with the mean of the rating column for that genre.

Example. Genre Action has ratings [4, 5] → entry Action: 4.5.

Notes. Genre order in the result doesn't matter. A genre with one rating returns that rating as its mean. Empty DataFrame → empty Series.

Previous
Orders per Customer
Next
Sort by Column (Descending)