import matplotlib.pylab as plt

import pandas as pd

country = 'Philippines'

df = pd.read_csv('../input/attacks_data_UTF8.csv', encoding='latin1', parse_dates=['Date'], infer_datetime_format=True, index_col=1)

if country is not None:
    dfc = df.loc[df['Country'] == country]
else:
    dfc = df

country_rank = df.Country.value_counts().rank(numeric_only=True, ascending=False).loc[country]
country_attacks = df.Country.value_counts()[country]
country_killed = dfc.Killed.sum()
country_injured = dfc.Injured.sum()

dfc.groupby('City').sum()[['Victims', 'Killed', 'Injured']].sort_values(by='Victims', ascending=0).plot(kind='bar', figsize=(17, 7), subplots=True)

most_victim = dfc.sort_values(by='Victims', ascending=False).head(1)
print("Attack with most victims happened on %s on %s with %d killed, %d injuries with a total of %d victims with the following article: \n'%s' \n" % (most_victim.City.values[0], most_victim.index.strftime('%B %d,%Y')[0], most_victim.Killed, most_victim.Injured, most_victim.Victims, '%s' % most_victim.Description.values[0]))
most_killed = dfc.sort_values(by='Killed', ascending=False).head(1)
print("Attack with the most deaths happened on %s on %s with %d killed, %d injuries with a total of %d victims with the following article: \n'%s' \n" % (most_killed.City.values[0], most_killed.index.strftime('%B %d,%Y')[0], most_killed.Killed, most_killed.Injured, most_killed.Victims, '%s' % most_killed.Description.values[0]))
most_injuries = dfc.sort_values(by='Injured', ascending=False).head(1)
print("Attack with the most injuries happened on %s on %s with %d killed, %d injuries with a total of %d victims with the following article: \n'%s' \n" % (most_injuries.City.values[0], most_injuries.index.strftime('%B %d,%Y')[0], most_injuries.Killed, most_injuries.Injured, most_injuries.Victims, '%s' % most_injuries.Description.values[0]))