from matplotlib import cm

import matplotlib.pyplot as plt

import numpy as np

import pandas as ps

import string

fileR = ps.read_csv('../input/3-Airplane_Crashes_Since_1908.txt', sep=',')

fileR['Date'] = ps.to_datetime(fileR['Date'])
fileR['year'] = fileR['Date'].dt.year
fileR['month'] = fileR['Date'].dt.month
fileR['day'] = fileR['Date'].dt.day
sub_years = [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010]
years_legend = list(string.ascii_letters[:len(sub_years)])
fileR['year_group'] = ''
for i in range(0, len(sub_years) - 1):
    fileR.loc[(sub_years[i + 1] > fileR['year']) & (fileR['year'] >= sub_years[i]), ['year_group']] = years_legend[i]

labels = ['1900-1910', '1910-1920', '1920-1930', '1930-1940', '1940-1950', '1950-1960', '1960-1970', '1970-1980', '1980-1990', '1990-2000', '2000-2010']
sizes = fileR[['Fatalities', 'year_group']].groupby('year_group').sum()
explode = (0, 0, 0, 0, 0, 0, 0, 0.1, 0.1, 0, 0)
colors = cm.Set1(np.arange(20) / 30.0)
plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=45)
plt.axis('equal')
plt.show()