X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/predictops.git/blobdiff_plain/288baa6ff06c1b815ec24d164770acc93ac80499..661ece8c54b20d4c559e5f73616cc213f8c4f6b7:/predictops/learn/preprocessing.py diff --git a/predictops/learn/preprocessing.py b/predictops/learn/preprocessing.py index 51ecb4e..106a626 100644 --- a/predictops/learn/preprocessing.py +++ b/predictops/learn/preprocessing.py @@ -171,9 +171,14 @@ class Preprocessing: # Dropping rows that are not related to our datetime window (start/ # step / end) - self._dataframe = self._dataframe.drop([k.to_pydatetime() - for k in self._dataframe.T - if k not in self._datetimes]) + logger.info("Dropping rows that are not related to our datetime window") + self._dataframe['datetime'] =\ + self._dataframe.apply(lambda x: datetime(int(x.year), int(x.month), int(x.dayInMonth), int(x.hour)), axis=1) + self._dataframe['row_ok'] =\ + self._dataframe.apply(lambda x:x.datetime in self._datetimes, axis=1) + self._dataframe = self._dataframe[self._dataframe['row_ok']] + self._dataframe = self._dataframe.drop(['datetime', 'row_ok'], axis=1) + logger.info("Rows dropped") def _add_history(self):