import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd # Make sure pandas is imported
# Assuming 'ratings' is your DataFrame and 'movieId' is the column with the movie ID
# Replace 'movieId' with the actual name of your movie ID column if different.
notas_do_toy_story = ratings.query("movieId==1") # Filtering ratings for Toy Story (movieId 1)
notas_do_jumanji = ratings.query("movieId==2") # Filtering ratings for Jumanji (movieId 2)
# Creating a new DataFrame with ratings for both movies
# Assuming 'rating' is the column name for the ratings
dados_para_boxplot = pd.concat([notas_do_toy_story, notas_do_jumanji])
# Add a 'filmeId' column for the boxplot
dados_para_boxplot['filmeId'] = dados_para_boxplot['movieId'].apply(lambda x: 1 if x == 1 else 2)
# Creating the boxplot with Seaborn
sns.boxplot(x="filmeId", y="rating", data=dados_para_boxplot) # Assuming 'rating' is the column name for ratings
plt.show()