# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# %matplotlib inline

df_info = pd.read_csv("Test.csv")

df_info.head()

df_info.shape
df_info.category_id
df_info['category_id'].value_counts()

df_info.groupby('category_id')['views',''].value_counts()

likes=df_info.likes
dislikes=df_info.dislikes
df_info['Ratio']=df_info.likes/df_info.dislikes
df_info.head(6)


# df_info.index
df_info.reset_index().plot.bar(x='index',y='Ratio')
# you can always create a temporary DataFrame with the index as a column usinng
# df.reset_index()

dislikes=df_info.groupby('category_id').dislikes.value_counts()
dislikes

v_df=df_info.groupby('category_id').views.sum().rename('total_views').\
reset_index().sort_values(by='total_views',ascending=False)
v_df

fig = v_df.plot.bar(x='category_id',y='total_views')



StarcoderdataJupyterScriptsDedupFiltered