Skip to content

Instantly share code, notes, and snippets.

@yucombinator
Last active February 10, 2019 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yucombinator/be831b64642a2ef08819b601ce0867f4 to your computer and use it in GitHub Desktop.
Save yucombinator/be831b64642a2ef08819b601ce0867f4 to your computer and use it in GitHub Desktop.
Lester / Uni WPS Data
Year Intersection Incident Date
2011 Sunview St / University Ave W 9520-MVC HIT AND RUN Jan 7 2011 8:12AM
2011 Lester St / University Ave W 9520-MVC HIT AND RUN Feb 5 2011 2:14AM
2011 Albert St / University Ave W 9500-MVC PROP. DAMAGE Feb 19 2011 12:51PM
2011 Albert St / University Ave W 9570-IMPAIRED DRIVER Feb 26 2011 6:50PM
2011 Albert St / University Ave W 9520-MVC HIT AND RUN Feb 26 2011 6:51PM
2011 Albert St / University Ave W 9520-MVC HIT AND RUN Mar 7 2011 6:30PM
2011 Albert St / University Ave W 9520-MVC HIT AND RUN Mar 8 2011 4:00PM
2011 Lester St / University Ave W 9520-MVC HIT AND RUN Mar 10 2011 10:00PM
2011 Lester St / University Ave W 9520-MVC HIT AND RUN Aug 8 2011 5:54PM
2011 Lester St / University Ave W 9510-MVC PERSONAL INJURY Aug 27 2011 3:00AM
2011 Albert St / University Ave W 9520-MVC HIT AND RUN Sep 12 2011 2:09PM
2011 Albert St / University Ave W 9510-MVC PERSONAL INJURY Nov 23 2011 2:53AM
2011 Albert St / University Ave W 9510-MVC PERSONAL INJURY Nov 27 2011 2:27PM
2012 Albert St / University Ave W 9510-MVC PERSONAL INJURY Jan 4 2012 1:16PM
2012 Sunview St / University Ave W 9520-MVC HIT AND RUN Jan 5 2012 8:41PM
2012 Lester St / University Ave W 9570-IMPAIRED DRIVER Jan 22 2012 2:36AM
2012 Albert St / University Ave W 9690-INJURED/SICK PERSON Feb 10 2012 1:19AM
2012 Lester St / University Ave W 9520-MVC HIT AND RUN Feb 11 2012 2:54AM
2012 Lester St / University Ave W 9510-MVC PERSONAL INJURY May 23 2012 6:02PM
2012 Lester St / University Ave W 9520-MVC HIT AND RUN May 24 2012 5:09PM
2012 Albert St / University Ave W 9510-MVC PERSONAL INJURY Jul 28 2012 6:26PM
2012 Albert St / University Ave W 9500-MVC PROP. DAMAGE Aug 25 2012 1:49PM
2012 Albert St / University Ave W 9500-MVC PROP. DAMAGE Sep 5 2012 4:45PM
2012 Albert St / University Ave W 9510-MVC PERSONAL INJURY Sep 29 2012 3:44PM
2012 Lester St / University Ave W 9510-MVC PERSONAL INJURY Oct 2 2012 7:52PM
2012 Lester St / University Ave W 9510-MVC PERSONAL INJURY Oct 8 2012 7:29PM
2012 Albert St / University Ave W 9510-MVC PERSONAL INJURY Oct 25 2012 12:18PM
2012 Sunview St / University Ave W 9510-MVC PERSONAL INJURY Oct 26 2012 11:29AM
2012 Lester St / University Ave W 9520-MVC HIT AND RUN Dec 19 2012 1:17AM
2013 Lester St / University Ave W 9520-MVC HIT AND RUN Jan 31 2013 4:20PM
2013 Albert St / University Ave W 9520-MVC HIT AND RUN Jan 31 2013 4:22PM
2013 Lester St / University Ave W 9510-MVC PERSONAL INJURY Mar 14 2013 11:00AM
2013 Albert St / University Ave W 9500-MVC PROP. DAMAGE Mar 22 2013 3:13AM
2013 Albert St / University Ave W 9510-MVC PERSONAL INJURY Apr 8 2013 10:55AM
2013 Lester St / University Ave W 9520-MVC HIT AND RUN May 7 2013 4:44PM
2013 Sunview St / University Ave W 9510-MVC PERSONAL INJURY Jun 5 2013 11:32PM
2013 Albert St / University Ave W 9510-MVC PERSONAL INJURY Jul 31 2013 12:40PM
2013 Lester St / University Ave W 9510-MVC PERSONAL INJURY Aug 2 2013 2:39PM
2013 Lester St / University Ave W 9500-MVC PROP. DAMAGE Aug 27 2013 3:06PM
2013 Lester St / University Ave W 9520-MVC HIT AND RUN Sep 20 2013 7:47PM
2013 Lester St / University Ave W 9510-MVC PERSONAL INJURY Sep 23 2013 5:50PM
2013 Albert St / University Ave W 9510-MVC PERSONAL INJURY Sep 25 2013 4:07PM
2013 Lester St / University Ave W 9510-MVC PERSONAL INJURY Oct 31 2013 9:36PM
2013 Albert St / University Ave W 9500-MVC PROP. DAMAGE Nov 2 2013 11:35AM
2014 Sunview St / University Ave W 9510-MVC PERSONAL INJURY 2014-01-24 13:26:23.000
2014 Lester St / University Ave W 9520-MVC HIT AND RUN 2014-01-25 16:58:55.000
2014 Albert St / University Ave W 9510-MVC PERSONAL INJURY 2014-02-26 18:02:49.000
2014 Lester St / University Ave W 9510-MVC PERSONAL INJURY 2014-02-28 23:15:42.000
2014 Albert St / University Ave W 9510-MVC PERSONAL INJURY 2014-03-09 09:48:21.000
2014 Albert St / University Ave W 9510-MVC PERSONAL INJURY 2014-05-30 07:03:18.000
2014 Albert St / University Ave W 9520-MVC HIT AND RUN 2014-09-25 15:38:42.000
2014 Albert St / University Ave W 9520-MVC HIT AND RUN 2014-09-29 14:08:09.000
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-07-16 12:42:15
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-07-21 19:36:54
2015 SUNVIEW ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-06-26 14:34:27
2015 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-07-28 21:35:12
2015 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-01-06 18:20:35
2015 SUNVIEW ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-12-23 09:36:39
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-08-13 02:37:07
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-09-14 11:24:54
2015 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-03-15 01:46:28
2015 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-11-10 17:32:20
2015 SUNVIEW ST / UNIVERSITY AVE W 9500-MVC PROP. DAMAGE 2015-10-20 16:51:40
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-12-14 15:02:51
2015 LESTER ST / UNIVERSITY AVE W 9500-MVC PROP. DAMAGE 2015-02-26 13:40:44
2015 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-04-03 01:14:53
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-11-11 10:04:37
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-03-11 11:22:39
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-05-29 02:08:32
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-04-01 18:41:22
2015 SUNVIEW ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-09-29 15:15:00
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-01-06 12:11:37
2015 LESTER ST / UNIVERSITY AVE W 9500-MVC PROP. DAMAGE 2015-07-19 17:32:36
2015 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2015-07-07 12:11:17
2015 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-06-26 17:46:14
2015 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-10-28 14:26:53
2015 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2015-03-03 00:14:31
2016 LESTER ST / UNIVERSITY AVE W 9500-MVC PROP. DAMAGE 2016-09-24 18:53:15
2016 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2016-07-13 16:58:13
2016 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2016-01-11 15:54:50
2016 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2016-01-17 02:45:07
2016 SUNVIEW ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2016-11-03 06:56:41
2016 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2016-03-23 14:56:42
2016 ALBERT ST / UNIVERSITY AVE W 9550-DRIVING COMPLAINT 2016-11-30 19:58:08
2017 ALBERT ST / UNIVERSITY AVE W 9500-MVC PROP. DAMAGE 2017-02-28 23:22:00
2017 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2017-11-11 17:35:39
2017 ALBERT ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2017-11-15 21:29:35
2017 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-10-29 01:46:17
2017 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-03-22 09:43:29
2017 LESTER ST / UNIVERSITY AVE W 9510-MVC PERSONAL INJURY 2017-02-24 13:12:11
2017 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-03-01 19:44:15
2017 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-02-03 17:46:27
2017 ALBERT ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-11-23 00:37:38
2017 LESTER ST / UNIVERSITY AVE W 9520-MVC HIT AND RUN 2017-02-14 21:02:26
import csv
files = ['WRPSOccurrenceData_Year_2011.csv',
'WRPSOccurrenceData_Year_2012.csv',
'WRPSOccurrenceData_Year_2013.csv',
'WRPSOccurrenceData_Year_2014.csv',
'WRPSOccurrenceData_Year_2015.csv',
'WRPSOccurrenceData_Year_2016_Jan16_2018.csv',
'WRPSOccurrenceData_Year_2017__August_28_2018.csv']
year = 2011
histo = dict()
with open('output.csv', 'w', newline='') as csvfile:
csvwriter = csv.writer(csvfile, delimiter=',')
csvwriter.writerow(['Year', 'Intersection', 'Incident', 'Date'])
for f in files :
with open(f) as csv_file:
print(f'YEAR: {year}')
histo[year] = 0
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
#print(f'Column names are {", ".join(row)}')
line_count += 1
else:
inters = row[2].upper()
report_type_1 = row[10]
report_type_2 = row[8]
if (("LESTER ST / UNIVERSITY AVE W" in inters or \
"SUNVIEW ST / UNIVERSITY AVE W" in inters or \
"ALBERT ST / UNIVERSITY AVE W" in inters) and ( \
"9530" in report_type_1 or \
"9510" in report_type_1 or \
"9520" in report_type_1 or \
"9530" in report_type_2 or \
"9510" in report_type_2 or \
"9520" in report_type_2)):
print(f'\t{row[2]} - {row[6]} - {row[10]}.')
csvwriter.writerow([year, row[2], row[10], row[6]])
histo[year] += 1
line_count += 1
print(f'Processed {line_count} lines.')
year += 1
print(histo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment