{"record":{"id":"4805cdde4a0efcb5","repo":"microsoft/qlib","slug":"this-type-of-input-is-not-supported-4805cd","errorCode":null,"errorMessage":"This type of input is not supported","messagePattern":"This type of input is not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/contrib/report/data/base.py","lineNumber":44,"sourceCode":"            Aggretation will be used for more summarized metrics overtime.\n            Here is an example of data:\n\n            .. code-block::\n\n                                            return\n                datetime   instrument\n                2007-02-06 equity_tpx     0.010087\n                           equity_spx     0.000786\n        \"\"\"\n        self._dataset = dataset\n        with TimeInspector.logt(\"calc_stat_values\"):\n            self.calc_stat_values()\n\n    def calc_stat_values(self):\n        pass\n\n    def plot_single(self, col, ax):\n        raise NotImplementedError(f\"This type of input is not supported\")\n\n    def skip(self, col):\n        return False\n\n    def plot_all(self, *args, **kwargs):\n        ax_gen = iter(sub_fig_generator(*args, **kwargs))\n        for col in self._dataset:\n            if not self.skip(col):\n                ax = next(ax_gen)\n                self.plot_single(col, ax)\n","sourceCodeStart":26,"sourceCodeEnd":55,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/report/data/base.py#L26-L55","documentation":"FeaAnalyser.plot_single (qlib/contrib/report/data/base.py) is an abstract hook: the base class intentionally raises NotImplementedError so every subclass must supply its own per-column plotting logic. Hitting it means an instance of the base class (or a subclass that never overrode plot_single) went through plot_all(), which calls plot_single(col, ax) for every non-skipped column.","triggerScenarios":"Calling plot_all() on a FeaAnalyser subclass that defines calc_stat_values but forgets to override plot_single; or instantiating FeaAnalyser itself and calling plot_all().","commonSituations":"Writing a custom feature analyser for qlib's report module and missing the plot_single implementation; refactoring a subclass and accidentally renaming/deleting the method so the base implementation is reached.","solutions":["Implement plot_single(self, col, ax) in your FeaAnalyser subclass to draw one column onto the matplotlib axes","If you did implement it, check for typos in the method name or wrong signature so the override actually binds","Do not instantiate the base FeaAnalyser directly; always use a concrete subclass"],"exampleFix":"class MyAna(FeaAnalyser):\n    def plot_single(self, col, ax):\n        self._dataset[col].plot.hist(ax=ax, bins=50)\n        ax.set_title(col)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"import inspect\n\ndef implements_plot_single(cls) -> bool:\n    return 'plot_single' in cls.__dict__ or any('plot_single' in vars(c) for c in cls.__mro__[1:-1] if c is not FeaAnalyser)","tryCatchPattern":"try:\n    ana.plot_all()\nexcept NotImplementedError as e:\n    logger.error('analyser %s lacks plot_single: %s', type(ana).__name__, e)","preventionTips":["Treat plot_single, calc_stat_values and skip as the required trio when subclassing FeaAnalyser","Add an abstractmethod-style smoke test that calls plot_all on a tiny DataFrame for each custom analyser"],"tags":["qlib","report","abstract-method","subclassing"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}