def add_ano_col()

in aiops/MicroAgents/loader/base.py [0:0]


    def add_ano_col(self):
        # Check if the 'normal' column exists
        if self.df is not None and  "normal" in self.df.columns:
            # Create the 'anomaly' column by inverting the boolean values of the 'normal' column
            self.df = self.df.with_columns(pl.col("normal").not_().alias("anomaly"))
        if self.df_seq is not None and "normal" in self.df_seq:
            # Create the 'anomaly' column by inverting the boolean values of the 'normal' column
            self.df_seq = self.df_seq.with_columns(pl.col("normal").not_().alias("anomaly"))

        # Check if the 'anomaly' column exists but no normal column
        if self.df is not None and  "anomaly" in self.df.columns and not "normal" in self.df.columns:
            # Create the 'normal' column by inverting the boolean values of the 'anomaly' column
            self.df = self.df.with_columns(pl.col("anomaly").not_().alias("normal"))