{"record":{"id":"ebb6af208e3364b4","repo":"microsoft/qlib","slug":"please-implement-the-assign-method","errorCode":null,"errorMessage":"Please implement the 'assign' method","messagePattern":"Please implement the 'assign' method","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/backtest/high_performance_ds.py","lineNumber":332,"sourceCode":"    def assign(self, col: str, metric: Union[dict, pd.Series]) -> None:\n        \"\"\"assign one metric.\n\n        Parameters\n        ----------\n        col : str\n            the metric name of one metric.\n        metric : Union[dict, pd.Series]\n            one metric with stock_id index, such as deal_amount, ffr, etc.\n            for example:\n                SH600068    NaN\n                SH600079    1.0\n                SH600266    NaN\n                           ...\n                SZ300692    NaN\n                SZ300719    NaN,\n        \"\"\"\n\n        raise NotImplementedError(f\"Please implement the 'assign' method\")\n\n    def transfer(self, func: Callable, new_col: str = None) -> Optional[BaseSingleMetric]:\n        \"\"\"compute new metric with existing metrics.\n\n        Parameters\n        ----------\n        func : Callable\n            the func of computing new metric.\n            the kwargs of func will be replaced with metric data by name in this function.\n            e.g.\n                def func(pa):\n                    return (pa > 0).sum() / pa.count()\n        new_col : str, optional\n            New metric will be assigned in the data if new_col is not None, by default None.\n\n        Return\n        ----------\n        BaseSingleMetric","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/backtest/high_performance_ds.py#L314-L350","documentation":"Error \"Please implement the 'assign' method\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/backtest/high_performance_ds.py:332 when the guard condition fails: \"Please implement the 'assign' 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.","commonSituations":"See trigger scenarios.","solutions":["Implement the `assign` method in your subclass before calling it.","Use a concrete class that provides `assign` instead of the abstract base."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}