application_vnd.jupyter.stderr_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import pandas as pd
import numpy as np
df = pd.read_csv('animes.csv')

for c in df.columns[12:]:
    df[c] = df[c].astype('int')
idx = []
for i in df.columns:
    idx.append(i.replace('genre_', ''))
df.columns = idx

import seaborn as sns
import matplotlib.pyplot as plt

number_genre = df[df.columns[12:]].sum(axis=1).value_counts().sort_index()
colors = []
maxg = max(number_genre)
for n in number_genre:
    x = 0.8 - n / (2 * maxg)
    colors.append((0.7, x, x))
average = number_genre.mean()
plt.figure(figsize=(10, 6))
number_genre.plot.bar(color=colors)
plt.title('Repartition of the number of genres', fontsize=18)
plt.axhline(average, 0, 1, color='black', lw=3)
plt.text(9.6, 120, 'average', fontsize=14)
plt.ylabel('Animes count', fontsize=14)
plt.xlabel('\nNumber of genres', fontsize=14)
plt.show()