{"record":{"id":"6e4cad300134d9f7","repo":"pathwaycom/pathway","slug":"column-of-type-dtypes-0-typehint-has-no-attribu","errorCode":null,"errorMessage":"Column of type {dtypes[0].typehint} has no attribute {expression._name}{with_arguments}.","messagePattern":"Column of type (.+?) has no attribute (.+?)(.+?)\\.","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/type_interpreter.py","lineNumber":609,"sourceCode":"\n    def eval_method_call(\n        self,\n        expression: expr.MethodCallExpression,\n        state: TypeInterpreterState | None = None,\n        **kwargs,\n    ) -> expr.MethodCallExpression:\n        expression = super().eval_method_call(expression, state=state, **kwargs)\n        dtypes = tuple([arg._dtype for arg in expression._args])\n        if (dtypes_and_handler := expression.get_function(dtypes)) is not None:\n            return _wrap(expression, dt.wrap(dtypes_and_handler[1]))\n\n        if len(dtypes) > 0:\n            with_arguments = (\n                f\" with arguments of type {[dtype.typehint for dtype in dtypes[1:]]}\"\n            )\n        else:\n            with_arguments = \"\"\n        raise AttributeError(\n            f\"Column of type {dtypes[0].typehint} has no attribute {expression._name}{with_arguments}.\"\n        )\n\n    def eval_unwrap(\n        self,\n        expression: expr.UnwrapExpression,\n        state: TypeInterpreterState | None = None,\n        **kwargs,\n    ) -> expr.UnwrapExpression:\n        expression = super().eval_unwrap(expression, state=state, **kwargs)\n        dtype = expression._expr._dtype\n        self._check_for_disallowed_types(\"pathway.unwrap\", dtype)\n        return _wrap(expression, dt.unoptionalize(dtype))\n\n    def eval_fill_error(\n        self,\n        expression: expr.FillErrorExpression,\n        state: TypeInterpreterState | None = None,","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/type_interpreter.py#L591-L627","documentation":"AttributeError raised by the type interpreter when a method call (e.g. column.str_to_upper(), column.dt_floor(), .dt_day(), ...) has no registered handler for the operand's dtype. Pathway dispatches methods on the column's static dtype; if no overload matches the argument types, the method does not exist for that type.","triggerScenarios":"Calling string methods on an int column (t.num.str_to_upper()), datetime methods on a string column (t.s.dt_hour()), or passing argument types the method does not accept (e.g. t.col.dt_floor(t.other_str_col)). Any MethodCallExpression whose (arg dtypes) tuple has no entry in the method's function table.","commonSituations":"CSV connector read a date column as str and developer calls .dt_* methods; column is Optional[str] or Optional[int] and the method only accepts the non-optional type; version upgrade removed/renamed a method; wrong argument type to a dt/str method.","solutions":["Recheck the column dtype (print table.schema) and call a method valid for that type","Convert types first: pw.this.col.astype(int), pw.this.col.dt_parse() / str_to_datetime before datetime ops","Unwrap Optional columns with pw.unwrap if the method requires non-optional input","Check the Pathway docs for the method's accepted dtypes and argument signature for your version"],"exampleFix":"// before\nres = t.select(hour=t.ts.dt_hour())  # t.ts is str from CSV\n\n// after\nt = t.with_columns(ts=pw.this.ts.dt_parse())\nres = t.select(hour=t.ts.dt_hour())","handlingStrategy":"type-guard","validationCode":"import pathway as pw\n\ndef check_method_supported(col, method_name: str, *arg_cols) -> bool:\n    dtypes = tuple([col._column.dtype] + [c._column.dtype for c in arg_cols])\n    from pathway.internals import expressions as expr  # debug helper\n    return dtypes  # compare against pathway expression method tables in tests","typeGuard":"import pathway as pw\n\ndef is_str_col(col) -> bool:\n    d = col._column.dtype\n    return d.equivalent_to(pw.string) or d.equivalent_to(pw.Optional[pw.string])\n\ndef is_datetime_col(col) -> bool:\n    return col._column.dtype.equivalent_to(pw.DateTimeNaive) or col._column.dtype.equivalent_to(pw.DateTimeUtc)","tryCatchPattern":"try:\n    res = t.select(h=t.ts.dt_hour())\nexcept AttributeError as e:\n    if 'has no attribute' in str(e):\n        t = t.with_columns(ts=pw.this.ts.dt_parse())\n        res = t.select(h=t.ts.dt_hour())\n    else:\n        raise","preventionTips":["Verify dtypes with table.schema before applying dtype-specific methods","Parse string timestamps with dt_parse()/str_to_datetime() before .dt_* calls","Pin the Pathway version and re-check method availability after upgrades"],"tags":["pathway","types","methods","dtype-dispatch"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}