]> AND Private Git Repository - predictops.git/blobdiff - predictops/target/toarea.py
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Adding a source module to check for redundancy in feature names.
[predictops.git] / predictops / target / toarea.py
index 72a8ad03139e366e70d66f53f64e4e5ef2d4b3c2..1454e9d862a54d3d03ddf5acbbe7a597439ed6e9 100644 (file)
@@ -1,46 +1,24 @@
 from csv import DictReader
 from datetime import datetime
 from csv import DictReader
 from datetime import datetime
-from os import listdir
-from pathlib import Path
 
 class ToArea:
 
     def __init__(self, area = None,
                  start = datetime.strptime('19960101000000', '%Y%m%d%H%M%S'),
 
 class ToArea:
 
     def __init__(self, area = None,
                  start = datetime.strptime('19960101000000', '%Y%m%d%H%M%S'),
-                 end = datetime.now()):
-        self._get_located_interventions()
+                 end = datetime.now(),
+                 csv_file = None):
 
 
+        self._area = area
+        self._csv_file = csv_file
+        self._get_located_interventions()
 
 
     def _get_located_interventions(self):
 
 
     def _get_located_interventions(self):
-        self._data_directory = Path.cwd() / 'data' / 'targets' / 'sdis25'
-        self._dict_interv = {}
-        for year in range(2006,2018):
-            if year < 2012:
-                file_place = self._data_directory / 'interventions' / (str(year)+'.csv')
-            else:
-                file_place = self._data_directory / 'victims' / ('Liste_des_victimes_'+str(year)+'.csv')
-            with open(file_place, "r") as f:
-                reader = DictReader(f, delimiter='£')
-                for row in reader:
-                    self._dict_interv.update({
-                        row['N° intervention']: {
-                            'X' : row['Coord X'],
-                            'Y' : row['Coord Y']
-                        } for row in reader
-                    })
-        for csv_file in listdir(self._data_directory / 'interventions'):
-            with open(self._data_directory / 'interventions' / csv_file, "r") as f:
-                reader = DictReader(f, delimiter='£')
-                for row in reader:
-                    if row['N° intervention'] in self._dict_interv:
-                        self._dict_interv[row['N° intervention']].update(
-                            {
-                                'start': row['Début'],
-                                'end'  : row['Fin']
-                            })
-                    else:
-                        print(row['N° intervention'])
+        with open(self._csv_file) as f:
+            reader = DictReader(f, delimiter=',')
+            for row in reader:
+                print(row)
+