apache/beam · error · WontImplementError
fillna(limit={method!r}, axis={axis!r}) is not supported bec
Error message
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}. What it means
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.
Source
Thrown at sdks/python/apache_beam/dataframe/frames.py:284
@frame_base.with_docs_from(pd.DataFrame)
@frame_base.args_to_kwargs(pd.DataFrame)
@frame_base.populate_defaults(pd.DataFrame)
@frame_base.maybe_inplace
def fillna(self, value, method, axis, limit, **kwargs):
"""When ``axis="index"``, both ``method`` and ``limit`` must be ``None``.
otherwise this operation is order-sensitive."""
# Default value is None, but is overriden with index.
axis = axis or 'index'
if axis in (0, 'index'):
if method is not None:
raise frame_base.WontImplementError(
f"fillna(method={method!r}, axis={axis!r}) is not supported "
"because it is order-sensitive. Only fillna(method=None) is "
f"supported with axis={axis!r}.",
reason="order-sensitive")
if limit is not None:
raise frame_base.WontImplementError(
f"fillna(limit={method!r}, axis={axis!r}) is not supported because "
"it is order-sensitive. Only fillna(limit=None) is supported with "
f"axis={axis!r}.",
reason="order-sensitive")
if isinstance(self, DeferredDataFrame) and isinstance(value,
DeferredSeries):
# If self is a DataFrame and value is a Series we want to broadcast value
# to all partitions of self.
# This is OK, as its index must be the same size as the columns set of
# self, so cannot be too large.
class AsScalar(object):
def __init__(self, value):
self.value = value
with expressions.allow_non_parallel_operations():
value_expr = expressions.ComputedExpression(
'as_scalar', lambda df: AsScalar(df), [value._expr],View on GitHub (pinned to 12126d8942)
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.
Example fix
// before df = df.fillna(value=0, limit=1) // after df = df.fillna(value=0)
Defensive patterns
Strategy: validation
Validate before calling
if kwargs.get('limit') is not None:
raise ValueError('fillna(limit=...) is unsupported in Beam; drop limit') Type guard
def fillna_is_deferrable(kwargs) -> bool:
return kwargs.get('method', None) is None and kwargs.get('limit', None) is None Try / catch
try:
df = df.fillna(value=0, limit=1)
except frame_base.WontImplementError:
df = df.fillna(value=0) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Porting pandas code that partially fills runs of NaNs (limit=1, limit=2) to Beam; time-series cleanup pipelines written against pandas semantics.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- fillna(method={method!r}, axis={axis!r}) is not supported be
- Grouping by a concrete ndarray is order sensitive.
- replace(method={method!r}) is not supported because it is or
- sort_values(axis=index) is not supported because it imposes
- align(method={method!r}) is not supported because it is orde
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/fbe2d31ed0b3ba72.
Report an issue: GitHub.