ratpmetro/main.py
def process(self):
        """
        Process the downloaded raw data frame (using Paris time zone, identifying incidents, resampling...)
        """
        assert self.df is not None

        # Convert to Paris time
        self.df["time"] = pd.DatetimeIndex(pd.to_datetime(self.df["time"]))
        self.df = self.df.set_index("time")
        self.df = self.df.tz_convert("Europe/Paris")
        self.df = self.df.sort_index()

        # Detect incidents from tweets
        self.df[["is_incident", "incident_cause"]] = self.df["tweet"].apply(
            self._detect_incident
        )

        # Uniformly resample timestamps every hour and extract time information
        self.df_processed = self.df.drop(["tweet"], axis=1)
        self.df_processed = self.df_processed.resample("30min").agg(
            {"is_incident": np.any, "incident_cause": self._agg_incident_cause}
        )
        for x in ["year", "month", "day", "weekday", "hour"]:
            self.df_processed[x] = eval(f"self.df_processed.index.{x}")

        Process the downloaded raw data frame (using Paris time zone, identifying incidents, resampling...)
        
Process the downloaded raw data frame (using Paris time zone, identifying incidents, resampling...)
Process the downloaded raw data frame ( using Paris time zone identifying incidents resampling ... )
def process(self):
        assert self.df is not None
        self.df["time"] = pd.DatetimeIndex(pd.to_datetime(self.df["time"]))
        self.df = self.df.set_index("time")
        self.df = self.df.tz_convert("Europe/Paris")
        self.df = self.df.sort_index()
        self.df[["is_incident", "incident_cause"]] = self.df["tweet"].apply(
            self._detect_incident
        )
        self.df_processed = self.df.drop(["tweet"], axis=1)
        self.df_processed = self.df_processed.resample("30min").agg(
            {"is_incident": np.any, "incident_cause": self._agg_incident_cause}
        )
        for x in ["year", "month", "day", "weekday", "hour"]:
            self.df_processed[x] = eval(f"self.df_processed.index.{x}")
def process ( self ) : assert self . df is not None self . df [ "time" ] = pd . DatetimeIndex ( pd . to_datetime ( self . df [ "time" ] ) ) self . df = self . df . set_index ( "time" ) self . df = self . df . tz_convert ( "Europe/Paris" ) self . df = self . df . sort_index ( ) self . df [ [ "is_incident" , "incident_cause" ] ] = self . df [ "tweet" ] . apply ( self . _detect_incident ) self . df_processed = self . df . drop ( [ "tweet" ] , axis = 1 ) self . df_processed = self . df_processed . resample ( "30min" ) . agg ( { "is_incident" : np . any , "incident_cause" : self . _agg_incident_cause } ) for x in [ "year" , "month" , "day" , "weekday" , "hour" ] : self . df_processed [ x ] = eval ( f"self.df_processed.index.{x}" )
Process the downloaded raw data frame (using Paris time zone, identifying incidents, resampling...)
Process the downloaded raw data frame ( using Paris time zone identifying incidents resampling ... )
"""
        Process the downloaded raw data frame (using Paris time zone, identifying incidents, resampling...)
        """ # Convert to Paris time # Detect incidents from tweets # Uniformly resample timestamps every hour and extract time information
self