Skip to content

Commit 6c18ab5

Browse files
committed
firestation data
1 parent 9a07e33 commit 6c18ab5

File tree

2 files changed

+299
-0
lines changed

2 files changed

+299
-0
lines changed

scraper/data/firestations.csv

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
address,lat,lng
2+
550 Blvd. St. Pierre,45.502644,-73.559248
3+
230 Blvd.Chèvremont,45.493473,-73.876561
4+
13795 Blvd. Pierrefonds,45.493300,-73.849787
5+
13 rue Centre Commercial,45.509543,-73.806234
6+
10 Sunnydale,45.493874,-73.806822
7+
3048 Blvd. Saint Charles,45.513063,-73.725610
8+
300 Surrey Drive,45.420775,-73.909979
9+
310 Beaurepaire Drive,45.428763,-73.868406
10+
401 Blvd. St-Jean,45.502372,-73.556953
11+
155 Avro,45.466420,-73.789794
12+
530 Blvd. Bouchard,45.447490,-73.735621
13+
5500 Bois Franc,45.493961,-73.744660
14+
2727 Poirier,45.508849,-73.709012
15+
820 Saint Germain,45.512828,-73.677819
16+
3175 Remembrance,45.437524,-73.691247
17+
114 Westminster North,45.453896,-73.648063
18+
6815 Cote St Luc Rd.,45.467901,-73.652072
19+
5520 MacDonald,45.483461,-73.639249
20+
1300 Dollard Ave.,45.426091,-73.626472
21+
4398 LaSalle Blvd.,45.459919,-73.562947
22+
nan,45.493583,-73.560128
23+
256 Young,45.491422,-73.572507
24+
1255 Richmond,45.477785,-73.585654
25+
523 Place St. Henri,45.456940,-73.595438
26+
6040 Monk,45.490019,-73.641667
27+
5260 Van Horne,45.497353,-73.622005
28+
5353 Gatineau,45.475588,-73.614142
29+
5369 Cote St Antoine,45.467317,-73.638627
30+
4760 Cumberland,45.486143,-73.598376
31+
19 Stanton,45.501689,-73.567256
32+
Ile Ste- Helene (Seasonal),45.512114,-73.566749
33+
75 Ontario East,45.494375,-73.580206
34+
1445 Saint Mathieu,45.528125,-73.557985
35+
2000 de Lormier,45.506054,-73.559280
36+
920 Saint Urbain,45.497930,-73.573047
37+
1212 Drummond,45.525675,-73.574348
38+
1041 Rachel,45.510025,-73.611714
39+
2151 Mont-Royal,45.523017,-73.592900
40+
5 Laurier West,45.517792,-73.607804
41+
40 Avenue Saint-Just,45.515189,-73.640895
42+
10 Roosevelt,45.563815,-73.610048
43+
8100 Blvd. Saint Michel,45.546340,-73.626616
44+
795 Jarry East,45.527366,-73.626316
45+
7405 Champagneur,45.556084,-73.670401
46+
10827 Lajeunesse,45.534563,-73.703952
47+
4180 de Salaberry,45.569452,-73.652883
48+
1945 Fleury East,45.544266,-73.650842
49+
10 Chabanel West,45.545305,-73.576555
50+
5375 1st Ave.,45.534619,-73.616198
51+
7041 St. Dominique,45.547163,-73.597980
52+
2111 Saint Zotique,45.567125,-73.575525
53+
6490 30th Avenue,45.539191,-73.541129
54+
3250 Sainte Catherine St. East,45.572476,-73.543639
55+
2915 Monsabre,45.601356,-73.522721
56+
8639 Pierre-de-Coubertin,45.562999,-73.541191
57+
5100 Hochelaga,45.547275,-73.550890
58+
3616 Hochelaga,45.597081,-73.600105
59+
6025 Lavoisier,45.501689,-73.567256
60+
5455 Antoine Dagenais,45.594244,-73.636059
61+
4340 Charleroi,45.617071,-73.621298
62+
12012 Rolland,45.603015,-73.558874
63+
7650 Blvd. Chateauneuf,45.448281,-73.635724
64+
11371 Notre Dame,13.738757,-89.184672
65+
11575 26th Ave.,45.671462,-73.504329
66+
14201 Sherbrooke East,45.652516,-73.563308
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
{
2+
"metadata": {
3+
"name": "",
4+
"signature": "sha256:e4af5377b8bbcedde2e17158ad68edc5539c61e4c61d71a2fcaf23ce5b073eaa"
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"cells": [
11+
{
12+
"cell_type": "code",
13+
"collapsed": false,
14+
"input": [
15+
"s=\"\"\"\n",
16+
"Division\tStation Number\tAddress\tFormer City\n",
17+
"11\t51\t550 Blvd. St. Pierre\tSte-Anne-de-Bellevue\n",
18+
" \t56\t230 Blvd.Ch\u00e8vremont\tIle Bizard\n",
19+
" \t57\t13795 Blvd. Pierrefonds\tPierrefonds\n",
20+
" \t58\t13 rue Centre Commercial\tRoxboro\n",
21+
" \t61\t10 Sunnydale\tDollard Des Ormeaux\n",
22+
"12\t54\t3048 Blvd. Saint Charles\tKirkland\n",
23+
" \t52\t300 Surrey Drive\tBaie-d'Urfe\n",
24+
" \t53\t310 Beaurepaire Drive\tBeaconsfield\n",
25+
" \t55\t401 Blvd. St-Jean\tPointe Claire\n",
26+
" \n",
27+
"\n",
28+
"13\t62\t155 Avro\tDorval Station 2\n",
29+
" \t63\t530 Blvd. Bouchard\tDorval Station 1\n",
30+
" \t71\t5500 Bois Franc\tSt. Laurent Station 2\n",
31+
" \t72\t2727 Poirier\tSt. Laurent Station 3\n",
32+
" \t73\t820 Saint Germain\tSt. Laurent Station 1\n",
33+
" \n",
34+
"\n",
35+
"14\t64\t3175 Remembrance\tLachine\n",
36+
" \t77\t114 Westminster North\tMontreal West\n",
37+
" \t78\t6815 Cote St Luc Rd.\tCote St. Luc\n",
38+
" \t79\t5520 MacDonald\tHampstead\n",
39+
" \n",
40+
"\n",
41+
"15\t65\t1300 Dollard Ave.\tLasalle\n",
42+
" \t66\t4398 LaSalle Blvd.\tVerdun\n",
43+
" \t67\t\tNun's Island\n",
44+
" \n",
45+
"\n",
46+
"16\t03\t256 Young\tMontreal\n",
47+
" \t15\t1255 Richmond\tMontreal\n",
48+
" \t23\t523 Place St. Henri\tMontreal\n",
49+
" \t33\t6040 Monk\tMontreal\n",
50+
" \n",
51+
"\n",
52+
"17\t04\t5260 Van Horne\tMontreal\n",
53+
" \t27\t5353 Gatineau\tMontreal\n",
54+
" \t34\t5369 Cote St Antoine\tMontreal\n",
55+
" \t46\t4760 Cumberland\tMontreal\n",
56+
" \t76\t19 Stanton\tWestmount\n",
57+
" \n",
58+
"\n",
59+
"18\t02\tIle Ste- Helene (Seasonal)\tMontreal\n",
60+
" \t05\t75 Ontario East\tMontreal\n",
61+
" \t10\t1445 Saint Mathieu\tMontreal\n",
62+
" \t19\t2000 de Lormier\tMontreal\n",
63+
" \t20\t920 Saint Urbain\tMontreal\n",
64+
" \t25\t1212 Drummond\tMontreal\n",
65+
" \n",
66+
"\n",
67+
"19\t16\t1041 Rachel\tMontreal\n",
68+
" \t26\t2151 Mont-Royal\tMontreal\n",
69+
" \t30\t5 Laurier West\tMontreal\n",
70+
" \t75\t40 Avenue Saint-Just\tOutremont\n",
71+
" \n",
72+
"\n",
73+
"20\t74\t10 Roosevelt\tMount Royal\n",
74+
" \t09\t8100 Blvd. Saint Michel\tMontreal\n",
75+
" \t37\t795 Jarry East\tMontreal\n",
76+
" \t41\t7405 Champagneur\tMontreal\n",
77+
" \n",
78+
"\n",
79+
"21\t35\t10827 Lajeunesse\tMontreal\n",
80+
" \t42\t4180 de Salaberry\tMontreal\n",
81+
" \t43\t1945 Fleury East\tMontreal\n",
82+
" \t49\t10 Chabanel West\tMontreal\n",
83+
" \n",
84+
"\n",
85+
"22\t29\t5375 1st Ave.\tMontreal\n",
86+
" \t31\t7041 St. Dominique\tMontreal\n",
87+
" \t47\t2111 Saint Zotique\tMontreal\n",
88+
" \t50\t6490 30th Avenue\tMontreal\n",
89+
" \n",
90+
"\n",
91+
"23\t13\t3250 Sainte Catherine St. East\tMontreal\n",
92+
" \t39\t2915 Monsabre\tMontreal\n",
93+
" \t40\t8639 Pierre-de-Coubertin\tMontreal\n",
94+
" \t45\t5100 Hochelaga\tMontreal\n",
95+
" \t48\t3616 Hochelaga\tMontreal\n",
96+
" \n",
97+
"\n",
98+
"24\t21\t6025 Lavoisier\tSt. Leonard Station 1\n",
99+
" \t22\t5455 Antoine Dagenais\tSt. Leonard Station 2\n",
100+
" \t17\t4340 Charleroi\tMontreal North Station 1\n",
101+
" \t18\t12012 Rolland\tMontreal North Station 2\n",
102+
" \n",
103+
"\n",
104+
"25\t28\t7650 Blvd. Chateauneuf\tAnjou\n",
105+
" \t08\t11371 Notre Dame\tMontreal East\n",
106+
" \t14\t11575 26th Ave.\tMontreal\n",
107+
" \t38\t14201 Sherbrooke East\tMontreal\n",
108+
" \t44\t12145 Blvd. Riviere des Prairies\tMontreal\n",
109+
"\"\"\""
110+
],
111+
"language": "python",
112+
"metadata": {},
113+
"outputs": [],
114+
"prompt_number": 1
115+
},
116+
{
117+
"cell_type": "code",
118+
"collapsed": false,
119+
"input": [
120+
"import pandas as pd\n",
121+
"from StringIO import StringIO"
122+
],
123+
"language": "python",
124+
"metadata": {},
125+
"outputs": [],
126+
"prompt_number": 4
127+
},
128+
{
129+
"cell_type": "code",
130+
"collapsed": false,
131+
"input": [
132+
"TESTDATA = StringIO(s)"
133+
],
134+
"language": "python",
135+
"metadata": {},
136+
"outputs": [],
137+
"prompt_number": 5
138+
},
139+
{
140+
"cell_type": "code",
141+
"collapsed": false,
142+
"input": [
143+
"df = pd.DataFrame.from_csv(TESTDATA, sep=\"\\t\", parse_dates=False)"
144+
],
145+
"language": "python",
146+
"metadata": {},
147+
"outputs": [],
148+
"prompt_number": 7
149+
},
150+
{
151+
"cell_type": "code",
152+
"collapsed": false,
153+
"input": [
154+
"df.columns.values"
155+
],
156+
"language": "python",
157+
"metadata": {},
158+
"outputs": [
159+
{
160+
"metadata": {},
161+
"output_type": "pyout",
162+
"prompt_number": 8,
163+
"text": [
164+
"array(['Station Number', 'Address', 'Former City'], dtype=object)"
165+
]
166+
}
167+
],
168+
"prompt_number": 8
169+
},
170+
{
171+
"cell_type": "code",
172+
"collapsed": false,
173+
"input": [
174+
"addresses = [x[0] for x in df[['Address']].values]"
175+
],
176+
"language": "python",
177+
"metadata": {},
178+
"outputs": [],
179+
"prompt_number": 13
180+
},
181+
{
182+
"cell_type": "code",
183+
"collapsed": false,
184+
"input": [
185+
"import geocoder"
186+
],
187+
"language": "python",
188+
"metadata": {},
189+
"outputs": [],
190+
"prompt_number": 14
191+
},
192+
{
193+
"cell_type": "code",
194+
"collapsed": false,
195+
"input": [
196+
"coords = [geocoder.google(addr + ' Montreal') for addr in filter(lambda x: type(x)==str, addresses)]"
197+
],
198+
"language": "python",
199+
"metadata": {},
200+
"outputs": [],
201+
"prompt_number": 38
202+
},
203+
{
204+
"cell_type": "code",
205+
"collapsed": false,
206+
"input": [
207+
"f = open('firestations.csv', 'wb')\n",
208+
"f.write('address,lat,lng\\n')\n",
209+
"for i,c in enumerate(coords):\n",
210+
" if c.status.find('ERROR') > -1:\n",
211+
" f.write(\"%s,,\\n\" % (addresses[i]))\n",
212+
" else:\n",
213+
" f.write(\"%s,%f,%f\\n\" % (addresses[i],c.lat,c.lng))\n",
214+
"f.close()"
215+
],
216+
"language": "python",
217+
"metadata": {},
218+
"outputs": [],
219+
"prompt_number": 42
220+
},
221+
{
222+
"cell_type": "code",
223+
"collapsed": false,
224+
"input": [],
225+
"language": "python",
226+
"metadata": {},
227+
"outputs": []
228+
}
229+
],
230+
"metadata": {}
231+
}
232+
]
233+
}

0 commit comments

Comments
 (0)