{"record":{"id":"b180d77779484efc","repo":"apache/beam","slug":"append-only-accepts-deferredseries-instances-received-type","errorCode":null,"errorMessage":"append() only accepts DeferredSeries instances, received {type(to_append)}","messagePattern":"append\\(\\) only accepts DeferredSeries instances, received (.+?)","errorType":"exception","errorClass":"WontImplementError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":1381,"sourceCode":"    return self.index\n\n  # Series.T == transpose. Both are a no-op\n  T = frame_base._elementwise_method('T', base=pd.Series)\n  transpose = frame_base._elementwise_method('transpose', base=pd.Series)\n  shape = property(\n      frame_base.wont_implement_method(\n          pd.Series, 'shape', reason=\"non-deferred-result\"))\n\n  @frame_base.with_docs_from(pd.Series, removed_method=PD_VERSION >= (2, 0))\n  @frame_base.args_to_kwargs(pd.Series, removed_method=PD_VERSION >= (2, 0))\n  @frame_base.populate_defaults(pd.Series, removed_method=PD_VERSION >= (2, 0))\n  def append(self, to_append, ignore_index, verify_integrity, **kwargs):\n    \"\"\"``ignore_index=True`` is not supported, because it requires generating an\n    order-sensitive index.\"\"\"\n    if PD_VERSION >= (2, 0):\n      raise frame_base.WontImplementError('append() was removed in Pandas 2.0.')\n    if not isinstance(to_append, DeferredSeries):\n      raise frame_base.WontImplementError(\n          \"append() only accepts DeferredSeries instances, received \" +\n          str(type(to_append)))\n    if ignore_index:\n      raise frame_base.WontImplementError(\n          \"append(ignore_index=True) is order sensitive because it requires \"\n          \"generating a new index based on the order of the data.\",\n          reason=\"order-sensitive\")\n\n    if verify_integrity:\n      # We can verify the index is non-unique within index partitioned data.\n      requires = partitionings.Index()\n    else:\n      requires = partitionings.Arbitrary()\n\n    return frame_base.DeferredFrame.wrap(\n        expressions.ComputedExpression(\n            'append', lambda s, to_append: s.append(\n                to_append, verify_integrity=verify_integrity, **kwargs),","sourceCodeStart":1363,"sourceCodeEnd":1399,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L1363-L1399","documentation":"DeferredSeries.append only accepts another DeferredSeries as to_append. Passing anything else (a plain pandas Series, list, scalar, dict) fails with a WontImplementError naming the received type, because Beam cannot incorporate non-deferred data into the expression graph at that call site.","triggerScenarios":"Calling deferred_s.append(pandas_series), deferred_s.append([1, 2, 3]), or any non-DeferredSeries object, on pandas < 2.0 (on >= 2.0 the removal error fires first).","commonSituations":"Mixing eagerly loaded pandas data with deferred pipeline data; appending Python lists copied from pandas examples.","solutions":["Wrap the eager data as a DeferredSeries first (e.g. via the beam dataframe conversion API on a PCollection, or pd.concat at the eager level).","Convert to pandas and append eagerly if you're outside the pipeline anyway.","Use pd.concat([...]) with plain pandas objects instead of the Beam-specific append."],"exampleFix":"// before\nresult = deferred_s.append([1, 2, 3])  # WontImplementError\n// after\nresult = deferred_s.append(beam_df_from(list_series))  # or pd.concat after to_pandas()","handlingStrategy":"type-guard","validationCode":"from apache_beam.dataframe.frames import DeferredSeries\nif not isinstance(to_append, DeferredSeries):\n    raise TypeError(f\"append() requires DeferredSeries, got {type(to_append)}\")","typeGuard":"def is_appendable(to_append):\n    return isinstance(to_append, DeferredSeries)","tryCatchPattern":"from apache_beam.dataframe import frame_base\ntry:\n    combined = s.append(to_append)\nexcept frame_base.WontImplementError as e:\n    if 'only accepts DeferredSeries' in str(e):\n        combined = pd.concat([s.to_pandas(), pd.Series(to_append)])\n    else:\n        raise","preventionTips":["Convert eager pandas objects into deferred frames before appending.","Type-check to_append at the call site, not at pipeline runtime.","Prefer pd.concat([...]) which accepts both eager and deferred inputs."],"tags":["apache-beam","dataframe","pandas","type-mismatch"],"backgroundTag":"type-mismatch","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"}