apache/beam · info

include_indexes=True for a Series input. Note that this para

Error message

include_indexes=True for a Series input. Note that this parameter is _not_ respected for DeferredSeries conversion.

What it means

In apache_beam.dataframe.schemas, converting a DeferredSeries proxy to a Beam element type ignores the include_indexes flag (indexes are only honored for DataFrame proxies). When a caller passes include_indexes=True with a Series, this warning tells them the flag has no effect on the resulting type.

Source

Thrown at sdks/python/apache_beam/dataframe/schemas.py:124

    proxy: pd.DataFrame, include_indexes: bool = False) -> type:
  """Generate an element_type for an element-wise PCollection from a proxy
  pandas object. Currently only supports converting the element_type for
  a schema-aware PCollection to a proxy DataFrame.

  Currently only supports generating a DataFrame proxy from a schema-aware
  PCollection.
  """
  return element_typehint_from_dataframe_proxy(proxy, include_indexes).user_type


def _element_typehint_from_proxy(
    proxy: pd.core.generic.NDFrame, include_indexes: bool = False):
  if isinstance(proxy, pd.DataFrame):
    return element_typehint_from_dataframe_proxy(
        proxy, include_indexes=include_indexes)
  elif isinstance(proxy, pd.Series):
    if include_indexes:
      warnings.warn(
          "include_indexes=True for a Series input. Note that this "
          "parameter is _not_ respected for DeferredSeries "
          "conversion.")
    return dtype_to_fieldtype(proxy.dtype)
  else:
    raise TypeError(f"Proxy '{proxy}' has unsupported type '{type(proxy)}'")


def element_typehint_from_dataframe_proxy(
    proxy: pd.DataFrame, include_indexes: bool = False) -> RowTypeConstraint:

  output_columns = []
  if include_indexes:
    remaining_index_names = list(proxy.index.names)
    i = 0
    while len(remaining_index_names):
      index_name = remaining_index_names.pop(0)
      if index_name is None:

View on GitHub (pinned to 12126d8942)

Solutions

  1. Remove include_indexes=True for Series inputs; it is ignored by design.
  2. If you need index values in the output, reset_index()/convert the Series to a DataFrame first.
  3. Rely on dtype_to_fieldtype: the produced type hint encodes only the Series values.

Example fix

# before
beam.dataframe.convert.to_element_typehint(series_proxy, include_indexes=True)
# after
beam.dataframe.convert.to_element_typehint(series_proxy)
Defensive patterns

Strategy: validation

Validate before calling

import pandas as pd
if isinstance(proxy, pd.Series) and include_indexes:
    include_indexes = False  # flag is ignored for Series anyway

Type guard

def supports_include_indexes(proxy) -> bool:
  import pandas as pd
  return isinstance(proxy, pd.DataFrame)

Prevention

When it happens

Trigger: Calling to_element_typehint (or the schema-inference path via expand/_unbatch_transform) on a Series proxy with include_indexes=True, e.g. via get_schema on a PCollection of DeferredSeries.

Common situations: Developers copying the DataFrame invocation pattern (where include_indexes matters) to Series pipelines and expecting index columns in the output schema.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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