{"record":{"id":"88ed7c6e4a303932","repo":"pandas-dev/pandas","slug":"passing-a-filterable-condition-to-a-non-table-inde","errorCode":null,"errorMessage":"passing a filterable condition to a non-table indexer [{self}]","messagePattern":"passing a filterable condition to a non-table indexer \\[(.+?)\\]","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"pandas/core/computation/pytables.py","lineNumber":347,"sourceCode":"                self.filter[2],\n            )\n        return self\n\n    def format(self):\n        \"\"\"return the actual filter format\"\"\"\n        return [self.filter]\n\n    # error: Signature of \"evaluate\" incompatible with supertype \"BinOp\"\n    def evaluate(self) -> Self | None:  # type: ignore[override]\n        if not self.is_valid:\n            raise ValueError(f\"query term is not valid [{self}]\")\n\n        rhs = self.conform(self.rhs)\n        values = list(rhs)\n\n        if self.op not in [\"==\", \"!=\"]:\n            if not self.is_in_table:\n                raise TypeError(\n                    f\"passing a filterable condition to a non-table indexer [{self}]\"\n                )\n            return None\n\n        if self.is_in_table and len(values) <= self._max_selectors:\n            return None\n        filter_op = self.generate_filter_op()\n        self.filter = (self.lhs.value, filter_op, Index(values))\n        return self\n\n    def generate_filter_op(self, invert: bool = False):\n        if (self.op == \"!=\" and not invert) or (self.op == \"==\" and invert):\n            return lambda axis, vals: ~axis.isin(vals)\n        else:\n            return lambda axis, vals: axis.isin(vals)\n\n\nclass JointFilterBinOp(FilterBinOp):","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/computation/pytables.py#L329-L365","documentation":"Raised in FilterBinOp.evaluate when self.op is not '==' or '!=' and self.is_in_table is False. A FilterBinOp is meant to translate value-list comparisons into PyTables isin-style filters; only equality (==) and inequality (!=) are eligible. A non-equality comparison (>, <, >=, <=, in, not in) against a non-table source (e.g. a fixed-format store or an axis that is not indexed) cannot be expressed as a filter, so the engine rejects it with TypeError.","triggerScenarios":"store.select('df', where='A > 5') against a fixed-format store (format='fixed'), or where 'A' is not an in-table queryable. Using 'in'/'not in' against a non-indexed axis. Combining a non-equality op with a term whose is_in_table flag is False.","commonSituations":"Writing with the default format='fixed' (not queryable) and attempting a where clause. Expecting inequality filters on a non-table store. Querying an index level that is not materialized.","solutions":["Write the store in table format with the relevant data_columns: store.put('df', df, format='table', data_columns=['A']).","For fixed-format stores, read the whole frame and filter in pandas.","Restrict where clauses on non-indexed sources to == / != (still require data_columns).","Migrate new code to Parquet for richer predicate pushdown."],"exampleFix":"// before\nstore.put('df', df)  # format='fixed' by default\nstore.select('df', where='A > 5')\n\n// after\nstore.put('df', df, format='table', data_columns=['A'])\nstore.select('df', where='A > 5')","handlingStrategy":"validation","validationCode":"def supports_filter(store, key: str) -> bool:\n    storer = store.get_storer(key)\n    return storer.is_table  # format='table' is required for filterable conditions\n\nassert supports_filter(store, 'df'), 'store must be table format to support filterable where clauses'","typeGuard":"def is_table_store(store, key: str) -> bool:\n    return bool(store.get_storer(key).is_table)","tryCatchPattern":"try:\n    store.select('df', where='A > 5')\nexcept TypeError as e:\n    if 'filterable condition' in str(e):\n        df = store.get('df')\n        df[df['A'] > 5]\n    else:\n        raise","preventionTips":["Write queryable stores with format='table' and explicit data_columns.","Reserve fixed-format stores for full reads only.","Route inequality predicates through pandas for non-table stores."],"tags":["pandas","hdfstore","pytables","filter","where","fixed-format"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}