Subtask 2.3: The General Audience and the Critics
To start with this task let's understand some following Columns that are contained in the dataset.
MetaCritic Column is contained in the database along with IMDb_rating.
MetaCritic is a name of a popular website that is to calculates average scores from those scores provided by popular Critics. Also, when the general audience rates the movies, the average rating produce from those ratings stands as IMDB rating.
In this subtask, we are going to analyze top-rated movies by both Critics and Audiences.
Now notice that MetaCritic Column has values according to 100 scales while IMDb_rating has values on 10 scales. So, let's take the first step by converting MetaCritic values from 100 to 10 scale values:
After the conversion of the MetaCritic column to a scale of 10, we need to find an average rating considering both MetaCritic and IMDb_rating. mean() function in pandas is used to calculate the average from a given set of data. Follow the code below to perform the same task:
NOTE: axis=1 in the above-given code is used to fetch values column-wise. follow the diagram below to under the concept in a better way:
Now, let's create a column named Avg_rating in a database, to store these average ratings calculated. Follow the steps below to perform the same task:
Moving ahead, the main motive of this task is to find movies that are highest in terms of Ratings related to both the above-given columns. Let's sort the Avg_rating column in descending order, to find the average with the highest value. To sort into descending order follow the code below:
Now. as a final step of this task we need to calculate the movies which have differences in IMDb_rating and MetaCritic less than 0.5. Along with that, the Avg_rating of those movies must be greater than 8.
NOTE: We are going to use the abs() function to apply this operation. The function is used to find the absolute value of the given value. For example, if we have a negative number then the absolute values to that number can be defined as a positive form of the same number.
Follow the code below to perform the same:
movies[(abs(movies['IMDb_rating']-movies['MetaCritic'])<0.5) & (movies['Avg_rating']>8)]
Let's store the above operation in a variable named UniversalAcclaim.
UniversalAcclaim = movies[(abs(movies['IMDb_rating']-movies['MetaCritic'])<0.5) & (movies['Avg_rating']>8)]