{"record":{"id":"e5a22e93c3890484","repo":"pathwaycom/pathway","slug":"table-windowby-received-extra-args-it-handles-g","errorCode":null,"errorMessage":"Table.windowby() received extra args.\nIt handles grouping only by a single column.","messagePattern":"Table\\.windowby\\(\\) received extra args\\.\nIt handles grouping only by a single column\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/arg_handlers.py","lineNumber":56,"sourceCode":"        raise ValueError(\n            \"Table.groupby() received extra kwargs.\\n\"\n            + \"You probably want to use Table.groupby(...).reduce(**kwargs) to compute output columns.\"\n        )\n    return (self, *args), {\n        \"id\": id,\n        \"sort_by\": sort_by,\n        \"_filter_out_results_of_forgetting\": _filter_out_results_of_forgetting,\n        \"instance\": instance,\n        \"_skip_errors\": _skip_errors,\n        \"_is_window\": _is_window,\n    }\n\n\ndef windowby_handler(\n    self, time_expr, *args, window, behavior=None, instance=None, **kwargs\n):\n    if args:\n        raise ValueError(\n            \"Table.windowby() received extra args.\\n\"\n            + \"It handles grouping only by a single column.\"\n        )\n    if kwargs:\n        raise ValueError(\n            \"Table.windowby() received extra kwargs.\\n\"\n            + \"You probably want to use Table.windowby(...).reduce(**kwargs) to compute output columns.\"\n        )\n    return (self, time_expr), {\n        \"window\": window,\n        \"behavior\": behavior,\n        \"instance\": instance,\n    }\n\n\ndef join_kwargs_handler(*, allow_how: bool, allow_id: bool):\n    def handler(self, other, *on, **kwargs):\n        processed_kwargs = {}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/arg_handlers.py#L38-L74","documentation":"Table.windowby() groups rows by exactly one time expression; unlike groupby it cannot take multiple positional grouping columns. Passing extra positional args (a second column, e.g. t.windowby(t.time, t.key, window=...)) raises this ValueError. Additional partitioning is expressed through the 'instance' keyword, not extra positional arguments.","triggerScenarios":"t.windowby(t.time, t.key, window=pw.temporal.tumbling(duration=...)); any call where a second positional argument is present before/after time_expr.","commonSituations":"Assuming windowby mirrors groupby's variadic signature; porting pandas resample('1min').groupby('key') style code; wanting per-key windows and not knowing about instance.","solutions":["Use the instance keyword for secondary partitioning: t.windowby(t.time, window=w, instance=t.key).","Remove extra positional columns if the window is meant to be global.","For per-key tumbling windows combine instance=t.key with the desired window object."],"exampleFix":"# before\nt.windowby(t.time, t.key, window=pw.temporal.tumbling(duration=timedelta(minutes=1)))\n\n# after\nt.windowby(\n    t.time,\n    window=pw.temporal.tumbling(duration=timedelta(minutes=1)),\n    instance=t.key,\n)","handlingStrategy":"validation","validationCode":"def checked_windowby(t, time_expr, *args, **kwargs):\n    if args:\n        raise TypeError(\"windowby takes only time_expr positionally; use instance= for extra grouping\")\n    return t.windowby(time_expr, **kwargs)\n\nt2 = checked_windowby(t, t.time, window=w, instance=t.key)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["windowby takes exactly one positional argument (the time expression).","Use instance=t.key for per-key windows instead of extra positional columns.","Note that pandas resample().groupby() patterns map to windowby(..., instance=...)."],"tags":["windowby","temporal","api-misuse"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}