Seaborn Project – Movie Rating Explorer
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
Bollywood Movie Ratings Dataset
# Movie Ratings Explorer
# The Movie Ratings Explorer project visualizes and analyzes Bollywood movie
# ratings based on type, year, and audience votes.
# It helps identify top-rated films, trends over time,
# and how different movie types perform
# using Seaborn and Matplotlib charts.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Load dataset
df = pd.read_csv("movie_ratings.csv")
# Bar plot: Average Rating by Type
plt.figure(figsize=(8, 5))
Type_ratings = df.groupby('Type')['Rating'].mean().reset_index()
sns.barplot(data=Type_ratings, x='Type', y='Rating', palette='coolwarm')
plt.title("Average Movie Ratings by Type")
plt.xlabel("Type")
plt.ylabel("Average Rating")
plt.show()
# Scatter plot: Rating vs Votes
plt.figure(figsize=(8, 5))
sns.scatterplot(data=df, x='Votes', y='Rating', hue='Type', size='Votes', sizes=(20, 200))
plt.title("Movie Ratings vs. Number of Votes")
plt.xlabel("Votes")
plt.ylabel("Rating")
plt.show()
# Line plot: Year-wise Average Rating
plt.figure(figsize=(8, 5))
yearly_avg = df.groupby('Year')['Rating'].mean().reset_index()
sns.lineplot(data=yearly_avg, x='Year', y='Rating', marker='o', color='purple')
plt.title("Average Rating Over the Years")
plt.ylabel("Average Rating")
plt.xlabel("Year")
plt.show()
# Box plot: Rating Distribution by Type
plt.figure(figsize=(8, 5))
sns.boxplot(data=df, x='Type', y='Rating', palette='Set2')
plt.title("Distribution of Ratings by Type")
plt.xlabel("Type")
plt.ylabel("Rating")
plt.show()
# Count Plot: Number of Movies by Type
plt.figure(figsize=(8, 5))
sns.countplot(data=df, x='Type', palette='pastel', order=df['Type'].value_counts().index)
plt.title("Number of Movies by Type")
plt.xlabel("Movie Type")
plt.ylabel("Count")
plt.tight_layout()
plt.show()
# Bar Plot: Total Votes by Movie Type
plt.figure(figsize=(8, 5))
type_votes = df.groupby('Type')['Votes'].sum().reset_index()
sns.barplot(data=type_votes, x='Type', y='Votes', palette='flare')
plt.title("Total Votes by Movie Type")
plt.xlabel("Movie Type")
plt.ylabel("Total Votes")
plt.tight_layout()
plt.show()If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

