top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Investigating Netflix Movies and Guest Stars in The Office

Writer's picture: Arpan SapkotaArpan Sapkota



First of all pandas and matplotlib was imported as pd and plt respectively

import pandas as pd
import matplotlib.pyplot as plt

Here office episodes dataset was read as dataframe

office_df = pd.read_csv('datasets/office_episodes.csv', parse_dates=['release_date'])

Based on the ratings colors was appended with the help of for loop as shown below:

for ind, row in office_df.iterrows():
    if row['scaled_ratings'] < 0.25:
        cols.append('red')
    elif row['scaled_ratings'] < 0.50:
        cols.append('orange')
    elif row['scaled_ratings'] < 0.75:
        cols.append('lightgreen')
    else:
        cols.append('darkgreen')

If the office dataframe row has guest then size 250 was appened and if it has no guest then size was kept 25 as shown in the loop below:

for ind, row in office_df.iterrows():
    if row['has_guests'] == False:
        sizes.append(25)
    else:
        sizes.append(250)

Data were divided according to the having guest and not having guest,

non_guest_df = office_df[office_df['has_guests'] == False]
guest_df = office_df[office_df['has_guests'] == True]

Finally, at the end the most popular guest star was printed

print(office_df[office_df['viewership_mil'] > 20]['guest_stars'])
top_star = 'Jessica Alba'

Popularity, Quality and Guest Appearances in office were resulted.

Viewership were plotted vertically and viewership were plotted horizontally on a plot. Viewership was displayed in Millions count. Data were falling between 7.5 to 10 Millions. Episode number from 0 to 175 having views not more than 10 Millions.

0 comments

Recent Posts

See All

コメント


COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page