{"record":{"id":"089cef04dd3e5131","repo":"microsoft/qlib","slug":"this-type-of-input-is-not-supported-089cef","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/data/utils/sepdf.py","lineNumber":168,"sourceCode":"\n    def __init__(self, sdf: SepDataFrame, join):\n        self._sdf = sdf\n        self.axis = None\n        self.join = join\n\n    def __call__(self, axis):\n        self.axis = axis\n        return self\n\n    def __getitem__(self, args):\n        if self.axis == 1:\n            if isinstance(args, str):\n                return self._sdf[args]\n            elif isinstance(args, (tuple, list)):\n                new_df_dict = {k: self._sdf[k] for k in args}\n                return SepDataFrame(new_df_dict, join=self.join if self.join in args else args[0], skip_align=True)\n            else:\n                raise NotImplementedError(f\"This type of input is not supported\")\n        elif self.axis == 0:\n            return SepDataFrame(\n                {k: df.loc(axis=0)[args] for k, df in self._sdf._df_dict.items()}, join=self.join, skip_align=True\n            )\n        else:\n            df = self._sdf\n            if isinstance(args, tuple):\n                ax0, *ax1 = args\n                if len(ax1) == 0:\n                    ax1 = None\n                if ax1 is not None:\n                    df = df.loc(axis=1)[ax1]\n                if ax0 is not None:\n                    df = df.loc(axis=0)[ax0]\n                return df\n            else:\n                return df.loc(axis=0)[args]\n","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/data/utils/sepdf.py#L150-L186","documentation":"Raised by SepDFLocGetter.__getitem__ (the object behind SepDataFrame.loc(axis=1)[...]) when selecting columns and the argument is neither a str nor a tuple/list of keys. SepDataFrame stores separate per-group frames, so fancy indexing (slices, boolean arrays, callables) on axis 1 has no implementation.","triggerScenarios":"Calling sdf.loc(axis=1)[args] where args is a slice (e.g. [:, 'KMID']), a boolean mask, an int, or a numpy array — only a column name or tuple/list of column names are handled at axis 1.","commonSituations":"Copy-pasting pandas .loc idioms (slices, boolean column masks) onto high-frequency data wrapped in SepDataFrame; passing a numpy array of column names instead of a plain list.","solutions":["Use a string or list of column names: sdf.loc(axis=1)['KMID'] or sdf.loc(axis=1)[['KMID', 'KLEN']].","Convert numpy arrays to lists: sdf.loc(axis=1)[list(col_array)].","For slice-based selection, first materialize the underlying pandas frame via sdf._df_dict[sdf.join] and use plain pandas .loc."],"exampleFix":"// before\nsub = sdf.loc(axis=1)[np.array([\"KMID\", \"KLEN\"])]  # NotImplementedError\n\n// after\nsub = sdf.loc(axis=1)[[\"KMID\", \"KLEN\"]]","handlingStrategy":"type-guard","validationCode":"cols = [\"KMID\", \"KLEN\"]\nassert all(isinstance(c, str) for c in cols)\nsub = sdf.loc(axis=1)[cols]  # list/tuple/str only","typeGuard":"def valid_axis1_args(args) -> bool:\n    return isinstance(args, str) or (isinstance(args, (tuple, list)) and all(isinstance(a, str) for a in args))","tryCatchPattern":"try:\n    sub = sdf.loc(axis=1)[args]\nexcept NotImplementedError:\n    sub = sdf._df_dict[sdf.join].loc(axis=1)[args]  # real pandas supports slices/masks","preventionTips":["Convert numpy arrays of column names to plain lists before indexing.","Use plain pandas on a materialized frame for slice/boolean column selection.","Only pass str or tuple/list-of-str to SepDataFrame loc(axis=1)."],"tags":["qlib","sepdf","pandas","loc","not-implemented"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}