1 from csv import DictReader
2 from datetime import datetime
4 from pathlib import Path
8 def __init__(self, area = None,
9 start = datetime.strptime('19960101000000', '%Y%m%d%H%M%S'),
10 end = datetime.now()):
11 self._get_located_interventions()
15 def _get_located_interventions(self):
16 self._data_directory = Path.cwd() / 'data' / 'targets' / 'sdis25'
17 self._dict_interv = {}
18 for year in range(2006,2018):
20 file_place = self._data_directory / 'interventions' / (str(year)+'.csv')
22 file_place = self._data_directory / 'victims' / ('Liste_des_victimes_'+str(year)+'.csv')
23 with open(file_place, "r") as f:
24 reader = DictReader(f, delimiter='£')
26 self._dict_interv.update({
27 row['N° intervention']: {
32 for csv_file in listdir(self._data_directory / 'interventions'):
33 with open(self._data_directory / 'interventions' / csv_file, "r") as f:
34 reader = DictReader(f, delimiter='£')
36 if row['N° intervention'] in self._dict_interv:
37 self._dict_interv[row['N° intervention']].update(
39 'start': row['Début'],
43 print(row['N° intervention'])