text_html_output_1.png
from plotly.offline import iplot, init_notebook_mode

from subprocess import check_output

import numpy as np

import pandas as pd

import plotly.graph_objs as go

import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()
from subprocess import check_output
pakistan = pd.read_csv('../input/PakistanDroneAttacks.csv', encoding='ISO-8859-1')
pakistan.columns = pakistan.columns.str.lower()
pakistan = pakistan.dropna(subset=['date'])
separate = pakistan['date'].str.split(',')
day, month, years = zip(*separate)
pakistan['years'] = years

pakistan_years = np.asarray(pakistan['years'].unique())
pakistan_died = pakistan.groupby('years')['total died mix'].count()
pakistan_injured = pakistan.groupby('years')['injured max'].count()
labels = ['DIED', 'INJURED']
colors = ['rgb(255, 51, 0)', 'rgb(0, 51, 204)']
x_data = pakistan_years
y_data = [pakistan_died, pakistan_injured]
traces = []
for i in range(0, 2):
    traces.append(go.Scatter(x=x_data, y=y_data[i], mode='splines', name=labels[i], line=dict(color=colors[i], width=1.5)))
layout = {'title': 'Died and Injured by Drone Acttack (2004-2017)', 'xaxis': {'title': 'Years'}, 'yaxis': {'title': 'People'}}
figure = dict(data=traces, layout=layout)
iplot(figure)