{"record":{"id":"ae82537b9230f01e","repo":"apache/beam","slug":"other-must-be-a-deferreddataframe-or-deferredseries-instance","errorCode":null,"errorMessage":"other must be a DeferredDataFrame or DeferredSeries instance. Passing a concrete list or numpy array is not supported. Those types have no index and must be joined based on the order of the data.","messagePattern":"other must be a DeferredDataFrame or DeferredSeries instance\\. Passing a concrete list or numpy array is not supported\\. Those types have no index and must be joined based on the order of the data\\.","errorType":"exception","errorClass":"WontImplementError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":1559,"sourceCode":"\n  @frame_base.with_docs_from(pd.DataFrame)\n  def dot(self, other):\n    \"\"\"``other`` must be a :class:`DeferredDataFrame` or :class:`DeferredSeries`\n    instance. Computing the dot product with an array-like is not supported\n    because it is order-sensitive.\"\"\"\n    left = self._expr\n    if isinstance(other, DeferredSeries):\n      right = expressions.ComputedExpression(\n          'to_dataframe',\n          pd.DataFrame, [other._expr],\n          requires_partition_by=partitionings.Arbitrary(),\n          preserves_partition_by=partitionings.Arbitrary())\n      right_is_series = True\n    elif isinstance(other, DeferredDataFrame):\n      right = other._expr\n      right_is_series = False\n    else:\n      raise frame_base.WontImplementError(\n          \"other must be a DeferredDataFrame or DeferredSeries instance. \"\n          \"Passing a concrete list or numpy array is not supported. Those \"\n          \"types have no index and must be joined based on the order of the \"\n          \"data.\",\n          reason=\"order-sensitive\")\n\n    dots = expressions.ComputedExpression(\n        'dot',\n        # Transpose so we can sum across rows.\n        (lambda left, right: pd.DataFrame(left @ right).T),\n        [left, right],\n        requires_partition_by=partitionings.Index())\n    with expressions.allow_non_parallel_operations(True):\n      sums = expressions.ComputedExpression(\n          'sum',\n          lambda dots: dots.sum(),  #\n          [dots],\n          requires_partition_by=partitionings.Singleton())","sourceCodeStart":1541,"sourceCodeEnd":1577,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L1541-L1577","documentation":"DeferredDataFrame.dot() requires the operand to be another DeferredDataFrame or DeferredSeries because matrix multiplication joins on indexes. Passing a concrete list or numpy array would require positional (order-based) joining, which is not deterministic in a distributed pipeline, so WontImplementError (reason 'order-sensitive') is raised.","triggerScenarios":"Calling df.dot([1, 2, 3]) or df.dot(np.array([...])), i.e. any other argument that is not a DeferredDataFrame/DeferredSeries (and isn't wrapped as one).","commonSituations":"Porting pandas snippets that compute dot products against raw lists/arrays; converting numeric code (linear algebra, weighted sums) to Beam dataframes.","solutions":["Wrap the operand in a DeferredSeries/DeferredDataFrame, e.g. beam.dataframe.Series from a PCollection with the right index","Convert the list to a pandas Series and then to a deferred frame via the Beam dataframe API","Compute the dot product with non-deferred pandas/numpy on collected data if the data is small enough"],"exampleFix":"// before\ndf.dot([1, 2, 3])\n// after\nweights = beam.dataframe.Series(index_pd_series_of_weights)  # deferred, with matching index\ndf.dot(weights)","handlingStrategy":"type-guard","validationCode":"assert isinstance(other, (DeferredDataFrame, DeferredSeries)), f'df.dot: unsupported operand {type(other)}'","typeGuard":"from apache_beam.dataframe.frames import DeferredDataFrame, DeferredSeries\ndef is_deferred_operand(other):\n    return isinstance(other, (DeferredDataFrame, DeferredSeries))","tryCatchPattern":"from apache_beam.dataframe import frame_base\ntry:\n    return df.dot(other)\nexcept frame_base.WontImplementError:\n    raise TypeError('Convert operand to DeferredDataFrame/DeferredSeries before dot()')","preventionTips":["Always wrap numpy/list operands into deferred frames with an index before arithmetic","Remember Beam dataframes align by index, not position","Unit-test ported pandas snippets against the deferred API early"],"tags":["pandas","apache-beam","dataframe","order-sensitive"],"backgroundTag":"incompatible-source-type","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}