apache/beam · error · WontImplementError
fillna(method={method!r}, axis={axis!r}) is not supported be
Error message
fillna(method={method!r}, axis={axis!r}) is not supported because it is order-sensitive. Only fillna(method=None) is supported with axis={axis!r}. What it means
apache_beam.dataframe (the Beam DataFrame API) raises this WontImplementError because fillna with a non-None method (e.g. 'ffill'/'bfill') fills values based on the position/order of rows, which the distributed Beam model cannot guarantee. Only method=None (value-based fill) is supported for axis=index/0. The error is a deliberate 'WontImplement' with reason='order-sensitive'.
Source
Thrown at sdks/python/apache_beam/dataframe/frames.py:278
return frame_base.DeferredFrame.wrap(
expressions.ComputedExpression(
'swaplevel', lambda df: df.swaplevel(**kwargs), [self._expr],
requires_partition_by=partitionings.Arbitrary(),
preserves_partition_by=partitionings.Arbitrary()))
@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):View on GitHub (pinned to 12126d8942)
Solutions
- Replace method='ffill'/'bfill' with an explicit value: df.fillna(value=<constant>) which is order-independent.
- If forward/backward fill is truly required, collect the data with to_pandas() (non-deferred) and use pandas fillna, then convert back.
- Restructure the pipeline to avoid order-dependent semantics, e.g. fill from a separately computed per-key value.
- If you genuinely need order-sensitive semantics and accept a non-parallelizable step, use allow_nonparallel=True style fallbacks or a plain pandas stage.
Example fix
// before df = df.fillna(method='ffill') // after df = df.fillna(value=0) # or fill from an explicitly computed per-group value
Defensive patterns
Strategy: validation
Validate before calling
if getattr(method, '__call__', None) is not None or method in ('ffill', 'bfill', 'pad', 'backfill'):
raise ValueError('Use fillna(value=...) with method=None in Beam DataFrame API') Type guard
def is_order_safe_fillna(kwargs) -> bool:
return kwargs.get('method', None) is None Try / catch
from apache_beam.dataframe import frame_base
try:
df = df.fillna(method='ffill')
except frame_base.WontImplementError:
df = df.fillna(value=0) Prevention
- Never pass method= or limit= to fillna in Beam code
- Replace fill strategies with explicit value-based fills
- Grep legacy pandas code for fillna(method= before porting to Beam
When it happens
Trigger: Calling df.fillna(method='ffill') or df.fillna(method='bfill') (or fillna(method=...) with axis=0/'index', the default axis) on a DeferredDataFrame/DeferredSeries. Also raised when a wrapper of fillna forwards a non-None method.
Common situations: Porting existing pandas code to Beam pipelines; forward/backward filling time-series gaps; copy-pasted pandas snippets that use the deprecated method= parameter of pandas fillna.
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(limit={method!r}, axis={axis!r}) is not supported bec
- 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/87dae060b90700f2.
Report an issue: GitHub.