def _validate_data()

in kats/models/metalearner/get_metadata.py [0:0]


    def _validate_data(self) -> None:
        """Validation function for checking input time seris."""

        # check if the time series length greater or equal to minimal length
        if len(self.data) < self.min_length:
            raise ValueError("Time series is too short!")

        # check if the time frequency is constant
        if pd.infer_freq(self.data.time) is None:
            raise ValueError("Only constant frequency is supported for time!")

        # check if the time series is constant
        if self.data.value.nunique() <= 1:
            raise ValueError("It's constant time series!")

        # check if the time series contains NAN, inf or -inf
        if np.any(np.isinf(self.data.value.values)) or np.any(
            np.isnan(self.data.value.values)
        ):
            raise ValueError("Time series contains NAN or infinity value(s)!")

        msg = "Valid time series data!"
        logging.info(msg)