text_html_output_1.png
import pandas as pd

filepath = '../input/mysteryanimemanga/myanimelist-anime-mystery-detective-cleaned.csv'
df = pd.read_csv(filepath)

df.columns

genres = ['Gourmet', 'Sports', 'Adventure', 'Avant Garde', 'Supernatural', 'Suspense', 'Slice of Life', 'Sci-Fi', 'Horror', 'Comedy', 'Drama', 'Fantasy', 'Action']
df_genres = df[genres].sum()

df_rated8_tv = df[(df['Rating'] > 8) & (df['Type'] == 'TV')]
df_rated8_tv[['Title', 'Rating']].sort_values(by='Rating', ascending=False)

df_rated8_movie = df[(df['Rating'] > 8) & (df['Type'] == 'Movie')]
df_rated8_movie[['Title', 'Rating']].sort_values(by='Rating', ascending=False)

df_rated8_ova = df[(df['Rating'] > 8) & (df['Type'] == 'OVA')]
df_rated8_ova[['Title', 'Rating']].sort_values(by='Rating', ascending=False)

df_rated8_special = df[(df['Rating'] > 8) & (df['Type'] == 'Special')]
df_rated8_special[['Title', 'Rating']].sort_values(by='Rating', ascending=False)

df_rated8_tv_genres = df_rated8_tv[genres].sum().sort_values(ascending=False)
df_rated8_movie_genres = df_rated8_movie[genres].sum().sort_values(ascending=False)
df_rated8_ova_genres = df_rated8_ova[genres].sum().sort_values(ascending=False)
df_rated8_special_genres = df_rated8_special[genres].sum().sort_values(ascending=False)
df_rated8_genre_count = pd.DataFrame({'TV': df_rated8_tv_genres, 'Movie': df_rated8_movie_genres, 'OVA': df_rated8_ova_genres, 'Special': df_rated8_special_genres})
df_rated8_genre_count