text_html_output_1.png
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]

countrySub = fileR.groupby('countries').sum()
dangerousCountries = countrySub.sort_values('Fatalities', ascending=False)
dangerousCountries['Fatalities'][:20].plot(kind='bar', color='g', fontsize=14, title='Highest fatalities based on the location')