In [1]:
import pandas as pd
In [2]:
data = pd.read_csv("Accidents7904.csv")
In [3]:
data_london = data[data['Police_Force'] == 1]
print data_london[:5]
In [4]:
data_london_new2 = data_london[['Date', 'Time', 'Number_of_Casualties']]
data_london_new2.head()
Out[4]:
In [5]:
data_london_new2.sort('Date', inplace=True)
#data_london_new2.set_index('Date', inplace=True)
data_london_new2.head()
Out[5]:
In [6]:
data_london_new2.sort('Time', inplace=True)
#data_london_new2.set_index('Date', inplace=True)
data_london_new2.head()
Out[6]:
In [7]:
writer = pd.ExcelWriter('output.xlsx')
data_london_new2.to_excel(writer,'Sheet1')
writer.save()
In [7]:
In [7]: