apache/beam · error · NotImplementedError

key

Error message

key

What it means

DeferredDataFrame.__getitem__ (df[key]) only supports selecting whole existing columns. If the key is not a list of known columns or a single known column name, the implementation cannot interpret it and raises NotImplementedError carrying the key object itself as the message.

Solutions

  1. Verify the column exists: print(df.columns) or check key in df before indexing.
  2. Use df.loc[key] for row/label-based access instead of df[key].
  3. Fix typos in the column name; compare with the proxy schema.
  4. Create the new column first with df['new'] = ... before indexing it.

Example fix

// before
col = df['valu']  # typo
// after
assert 'value' in df.columns
col = df['value']
Defensive patterns

Strategy: validation

Validate before calling

keys = key if isinstance(key, list) else [key]
missing = [k for k in keys if k not in df.columns]
if missing:
    raise KeyError(f'columns not found: {missing}')

Type guard

def is_valid_column(df, key) -> bool:
    keys = key if isinstance(key, list) else [key]
    return all(k in df._expr.proxy().columns for k in keys)

Try / catch

try:
    col = df[key]
except NotImplementedError as e:
    logger.error('Column selection failed, key=%r not in columns', e.args[0])
    col = None

Prevention

When it happens

Trigger: df['nonexistent_column']; df[new_columns_after_setitem] where the column was added out of band; df[['a', 'typo']]; indexing with a computed/renamed key not present in the proxy schema.

Common situations: Schema drift between the pandas proxy and the runtime data; typos in column names; attempting label-based row indexing (should be .loc) via df[some_row_label].

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/6eeb1372e2c8fd18. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/dataframe/frames.py:2552

    elif isinstance(key, slice):
      if _is_null_slice(key):
        return self
      elif _is_integer_slice(key):
        # This depends on the contents of the index.
        raise frame_base.WontImplementError(
            "Integer slices are not supported as they are ambiguous. Please "
            "use iloc or loc with integer slices.")
      else:
        return self.loc[key]

    elif (
        (isinstance(key, list) and all(key_column in self._expr.proxy().columns
                                       for key_column in key)) or
        key in self._expr.proxy().columns):
      return self._elementwise(lambda df: df[key], 'get_column')

    else:
      raise NotImplementedError(key)

  def __contains__(self, key):
    # Checks if proxy has the given column
    return self._expr.proxy().__contains__(key)

  def __setitem__(self, key, value):
    if isinstance(
        key, str) or (isinstance(key, list) and
                      all(isinstance(c, str)
                          for c in key)) or (isinstance(key, DeferredSeries) and
                                             key._expr.proxy().dtype == bool):
      # yapf: disable
      return self._elementwise(
          lambda df, key, value: df.__setitem__(key, value),
          'set_column',
          (key, value),
          inplace=True)
    else:

View on GitHub (pinned to 12126d8942)