Skip to content
# Add your Python code here!

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

%matplotlib inline



most_popular = pd.read_excel("most-popular.xlsx")
all_weeks_global = pd.read_excel("all-weeks-global.xlsx")
all_weeks_global.shape
all_weeks_global.info
all_weeks_global.columns
all_weeks_global.head()
all_weeks_global.isna().any()
most_popular.head()
most_popular_by_category = most_popular.groupby("category", as_index=False).agg(dict(hours_viewed_first_28_days=sum,
                                                    ))
most_popular_by_category
cat_x = most_popular_by_category["category"]
hour_y = most_popular_by_category["hours_viewed_first_28_days"]
plt.bar(cat_x, hour_y)
plt.show()
sorted_popular = most_popular[["category","show_title","rank","hours_viewed_first_28_days"]].sort_values("hours_viewed_first_28_days", ascending=False)
sorted_popular