microsoft/qlib · error · NotImplementedError

Please implement the 'get_metric_series' method

Error message

Please implement the 'get_metric_series' method

What it means

Error "Please implement the 'get_metric_series' method" thrown in microsoft/qlib.

Source

Thrown at qlib/backtest/high_performance_ds.py:377

        else:
            return tmp_metric

    def get_metric_series(self, metric: str) -> pd.Series:
        """return the single metric with pd.Series format.

        Parameters
        ----------
        metric : str
            the metric name.

        Return
        ----------
        pd.Series
            the single metric.
            If there is no metric name in the data, return pd.Series().
        """

        raise NotImplementedError(f"Please implement the 'get_metric_series' method")

    def get_index_data(self, metric: str) -> SingleData:
        """get one metric with the format of SingleData

        Parameters
        ----------
        metric : str
            the metric name.

        Return
        ------
        IndexData.Series
            one metric with the format of SingleData
        """

        raise NotImplementedError(f"Please implement the 'get_index_data' method")

    @staticmethod

View on GitHub (pinned to 79633dd950)

Solutions

  1. Implement the `get_metric_series` method in your subclass before calling it.
  2. Use a concrete class that provides `get_metric_series` instead of the abstract base.

When it happens

Trigger: This error is raised at qlib/backtest/high_performance_ds.py:377 when the guard condition fails: "Please implement the 'get_metric_series' method". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/bc144f60619ecd75. Report an issue: GitHub.