image_output_3.png image_output_2.png image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

pd.set_option('display.max_rows', 10)
pd.set_option('display.max_columns', 10)

games = pd.read_csv('../input/chess-games/games.csv')

games.columns

games.loc[:, 'first_move'] = games.moves.map(lambda x: x.split(' ')[0])

chosen_cols = ['winner', 'increment_code', 'white_rating', 'black_rating', 'opening_name', 'first_move']

increment_code_values = ['10+0', '15+0', '15+15']
rapid_games = games[games.increment_code.isin(increment_code_values)][chosen_cols]
rapid_games.set_index('opening_name', inplace=True)

appearances = rapid_games.groupby('opening_name').winner.count().rename('appearances')
rapid_games = rapid_games.merge(appearances, how='left', on='opening_name')

plt.subplots(figsize=[12, 5])
sns.violinplot(data=appearances, x=appearances.index, color='cornflowerblue')
plt.title('Violin Plot of Openings by Apperances')
plt.ylabel('openings')
plt.subplots(figsize=[12, 5])
sns.boxenplot(data=appearances, x=appearances.index, color='cornflowerblue')
plt.title('Boxen plot of Openings by Apperances')
plt.ylabel('openings')
plt.subplots(figsize=[12, 5])
sns.stripplot(data=appearances, x=appearances.index, color='cornflowerblue')
plt.title('Strip plot of Openings by Apperances')
plt.ylabel('openings')
plt.show()