text_html_output_1.png
import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

youtube = pd.read_csv('/kaggle/input/youtube-new/GBvideos.csv')

missing_values_count = youtube.isnull().sum()
missing_values_count

total_cells = np.product(youtube.shape)
total_missing = missing_values_count.sum()
total_missing / total_cells * 100

youtube.loc[pd.isna(youtube['description']), :].index

youtube = youtube.fillna('no description available for this video')
youtube.loc[91]

column_names = ['title', 'trending_date']
duplicates2 = youtube.duplicated(subset=column_names, keep=False)
youtube[duplicates2].sort_values(by='title')

youtube = youtube.drop_duplicates(['title', 'trending_date'], keep='first')
youtube[youtube['title'] == '13 Reasons Why: Season 2 | Official Trailer [HD] | Netflix']

youtube['trending_date'] = pd.to_datetime(youtube['trending_date'], format='%y.%d.%m')
youtube['publish_time'] = pd.to_datetime(youtube['publish_time'])

youtube.to_csv('youtube_edited.csv', index=False)

youtube.groupby('category_id').agg({'views': 'max', 'likes': 'max', 'dislikes': 'max'})