{"record":{"id":"fbe2d31ed0b3ba72","repo":"apache/beam","slug":"fillna-limit-method-r-axis-axis-r-is-not-supported-because","errorCode":null,"errorMessage":"fillna(limit={method!r}, axis={axis!r}) is not supported because it is order-sensitive. Only fillna(limit=None) is supported with axis={axis!r}.","messagePattern":"fillna\\(limit=(.+?), axis=(.+?)\\) is not supported because it is order-sensitive\\. Only fillna\\(limit=None\\) is supported with axis=(.+?)\\.","errorType":"exception","errorClass":"WontImplementError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/dataframe/frames.py","lineNumber":284,"sourceCode":"  @frame_base.with_docs_from(pd.DataFrame)\n  @frame_base.args_to_kwargs(pd.DataFrame)\n  @frame_base.populate_defaults(pd.DataFrame)\n  @frame_base.maybe_inplace\n  def fillna(self, value, method, axis, limit, **kwargs):\n    \"\"\"When ``axis=\"index\"``, both ``method`` and ``limit`` must be ``None``.\n    otherwise this operation is order-sensitive.\"\"\"\n    # Default value is None, but is overriden with index.\n    axis = axis or 'index'\n\n    if axis in (0, 'index'):\n      if method is not None:\n        raise frame_base.WontImplementError(\n            f\"fillna(method={method!r}, axis={axis!r}) is not supported \"\n            \"because it is order-sensitive. Only fillna(method=None) is \"\n            f\"supported with axis={axis!r}.\",\n            reason=\"order-sensitive\")\n      if limit is not None:\n        raise frame_base.WontImplementError(\n            f\"fillna(limit={method!r}, axis={axis!r}) is not supported because \"\n            \"it is order-sensitive. Only fillna(limit=None) is supported with \"\n            f\"axis={axis!r}.\",\n            reason=\"order-sensitive\")\n\n    if isinstance(self, DeferredDataFrame) and isinstance(value,\n                                                          DeferredSeries):\n      # If self is a DataFrame and value is a Series we want to broadcast value\n      # to all partitions of self.\n      # This is OK, as its index must be the same size as the columns set of\n      # self, so cannot be too large.\n      class AsScalar(object):\n        def __init__(self, value):\n          self.value = value\n\n      with expressions.allow_non_parallel_operations():\n        value_expr = expressions.ComputedExpression(\n            'as_scalar', lambda df: AsScalar(df), [value._expr],","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/frames.py#L266-L302","documentation":"Same order-sensitivity restriction as fillna(method=...), but for the limit parameter: limit caps how many consecutive NaNs ffill/bfill will fill, which requires knowing row order. Beam raises WontImplementError whenever limit is not None with axis=0/'index'. Note the message contains a small bug — it interpolates method!r where limit is meant.","triggerScenarios":"df.fillna(value=x, limit=5) or any fillna call with a non-None limit and axis=0/'index' (the default) on a deferred frame.","commonSituations":"Porting pandas code that partially fills runs of NaNs (limit=1, limit=2) to Beam; time-series cleanup pipelines written against pandas semantics.","solutions":["Remove the limit parameter and fill all NaNs with a fixed value (limit=None).","Do the limited fill in pandas after to_pandas() collection.","Compute the fill explicitly (e.g. per-key aggregates) to stay order-independent.","If limit semantics are essential, keep that stage outside the Beam DataFrame API."],"exampleFix":"// before\ndf = df.fillna(value=0, limit=1)\n// after\ndf = df.fillna(value=0)","handlingStrategy":"validation","validationCode":"if kwargs.get('limit') is not None:\n    raise ValueError('fillna(limit=...) is unsupported in Beam; drop limit')","typeGuard":"def fillna_is_deferrable(kwargs) -> bool:\n    return kwargs.get('method', None) is None and kwargs.get('limit', None) is None","tryCatchPattern":"try:\n    df = df.fillna(value=0, limit=1)\nexcept frame_base.WontImplementError:\n    df = df.fillna(value=0)","preventionTips":["Omit the limit argument when filling NaNs in Beam","If partial fills matter, do them in a to_pandas() stage","Audit time-series code for limit= usage before migrating"],"tags":["apache-beam","dataframe","pandas","order-sensitive","fillna"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}