]> AND Private Git Repository - predictops.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Starting to investigate the fact that qualitative features with NaN
authorChristophe Guyeux <christophe.guyeux@univ-fcomte.fr>
Mon, 17 Feb 2020 11:30:47 +0000 (12:30 +0100)
committerChristophe Guyeux <christophe.guyeux@univ-fcomte.fr>
Mon, 17 Feb 2020 11:30:47 +0000 (12:30 +0100)
values cannot be filled in the same way than quantitative ones

config/features/meteofrance_features.csv
predictops/learn/preprocessing.py
predictops/source/ephemeris.py
predictops/source/meteofrance.py
predictops/source/source.py

index 0253d1ccbd6472d8a057709aeef42b7a38436bcf..8623303a4ebcdd78f6e048196e91569b21667aa7 100644 (file)
@@ -1,4 +1,4 @@
-abbreviation,name,unit,type,type
+abbreviation,name,unit,format,type
 t,temperature,K,real,1
 pres,pressure,Pa,integer,1
 tend,pressureVariation,Pa,integer,1
 t,temperature,K,real,1
 pres,pressure,Pa,integer,1
 tend,pressureVariation,Pa,integer,1
index a878a8215d83e8cd504ff7f345cbd1c15165a7e7..49d7ef89bc2b2644f34f2022c3ee53d9827db98f 100644 (file)
@@ -48,14 +48,14 @@ class Preprocessing:
         else:
             self._features = set(chain.from_iterable([tuple(u.keys())
                                                       for u in [*dict_features.values()]]))
         else:
             self._features = set(chain.from_iterable([tuple(u.keys())
                                                       for u in [*dict_features.values()]]))
-        for csv_file in listdir():
-            with open(csv_file, "r") as f:
-                reader = DictReader(f, delimiter=',')
-                dico_features = {{row['name']: row['type']  # qualitative (2) or quantitative (1)
-                                    }
-                                for row in reader if row['name'] in self._features}
-
+        csv_files = Path.cwd() / 'config' / 'features'
         self._features = {feat : None for feat in self._features}
         self._features = {feat : None for feat in self._features}
+        for csv_file in listdir(csv_files):
+            with open(csv_files / csv_file, "r") as f:
+                reader = DictReader(f, delimiter=',')
+                for row in reader:
+                    if row['name'] in self._features:
+                        self._features[row['name']] = row['type']
         print(self._features)
         exit()
 
         print(self._features)
         exit()
 
index d0e4ca06cb14a5a9ec18e17ce626a83498434647..2a343642bdb3f8959365c71f4b4692c33955e527 100644 (file)
@@ -1,3 +1,5 @@
+from .source import Source
+
 from configparser import ConfigParser
 from csv import DictReader
 from datetime import datetime, timedelta
 from configparser import ConfigParser
 from csv import DictReader
 from datetime import datetime, timedelta
@@ -16,7 +18,7 @@ class Ephemeris:
     def __init__(self, config_file):
 
         # Check for the integrity of feature names
     def __init__(self, config_file):
 
         # Check for the integrity of feature names
-        super(Source, self).__init__()
+        Source.__init__(self)
 
         self._config = ConfigParser()
         self._config.read(config_file)
 
         self._config = ConfigParser()
         self._config.read(config_file)
index 3d8ae885157a9d00f49770d252afba275398f4ac..6bd23edc1435b857c5a2a00150778870ad30ebd7 100644 (file)
@@ -53,7 +53,7 @@ class MeteoFrance(Source):
 
         '''
         # Check for the integrity of feature names
 
         '''
         # Check for the integrity of feature names
-        super(Source, self).__init__()
+        Source.__init__(self)
 
         self._config = ConfigParser()
         self._config.read(config_file)
 
         self._config = ConfigParser()
         self._config.read(config_file)
index 714ed12e941a76b00c7cf6604836bbff04656117..8e68716e3b85f74767c6067f6b9ea866ecd0cfc9 100644 (file)
@@ -17,7 +17,7 @@ class Source:
         csv_files = Path.cwd() / 'config' / 'features'
         list_of_names = []
         for csv_file in listdir(csv_files):
         csv_files = Path.cwd() / 'config' / 'features'
         list_of_names = []
         for csv_file in listdir(csv_files):
-            with open(csv_file, "r") as f:
+            with open(csv_files / csv_file, "r") as f:
                 reader = DictReader(f, delimiter=',')
                 list_of_names.extend([row['name'] for row in reader])
         if len(list_of_names) != len(set(list_of_names)):
                 reader = DictReader(f, delimiter=',')
                 list_of_names.extend([row['name'] for row in reader])
         if len(list_of_names) != len(set(list_of_names)):