{"record":{"id":"3a5eb158932ff38b","repo":"apache/beam","slug":"include-indexes-true-for-a-series-input-note-that-this","errorCode":null,"errorMessage":"include_indexes=True for a Series input. Note that this parameter is _not_ respected for DeferredSeries conversion.","messagePattern":"include_indexes=True for a Series input\\. Note that this parameter is _not_ respected for DeferredSeries conversion\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"sdks/python/apache_beam/dataframe/schemas.py","lineNumber":124,"sourceCode":"    proxy: pd.DataFrame, include_indexes: bool = False) -> type:\n  \"\"\"Generate an element_type for an element-wise PCollection from a proxy\n  pandas object. Currently only supports converting the element_type for\n  a schema-aware PCollection to a proxy DataFrame.\n\n  Currently only supports generating a DataFrame proxy from a schema-aware\n  PCollection.\n  \"\"\"\n  return element_typehint_from_dataframe_proxy(proxy, include_indexes).user_type\n\n\ndef _element_typehint_from_proxy(\n    proxy: pd.core.generic.NDFrame, include_indexes: bool = False):\n  if isinstance(proxy, pd.DataFrame):\n    return element_typehint_from_dataframe_proxy(\n        proxy, include_indexes=include_indexes)\n  elif isinstance(proxy, pd.Series):\n    if include_indexes:\n      warnings.warn(\n          \"include_indexes=True for a Series input. Note that this \"\n          \"parameter is _not_ respected for DeferredSeries \"\n          \"conversion.\")\n    return dtype_to_fieldtype(proxy.dtype)\n  else:\n    raise TypeError(f\"Proxy '{proxy}' has unsupported type '{type(proxy)}'\")\n\n\ndef element_typehint_from_dataframe_proxy(\n    proxy: pd.DataFrame, include_indexes: bool = False) -> RowTypeConstraint:\n\n  output_columns = []\n  if include_indexes:\n    remaining_index_names = list(proxy.index.names)\n    i = 0\n    while len(remaining_index_names):\n      index_name = remaining_index_names.pop(0)\n      if index_name is None:","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/dataframe/schemas.py#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"Developers copying the DataFrame invocation pattern (where include_indexes matters) to Series pipelines and expecting index columns in the output schema.","solutions":["Remove include_indexes=True for Series inputs; it is ignored by design.","If you need index values in the output, reset_index()/convert the Series to a DataFrame first.","Rely on dtype_to_fieldtype: the produced type hint encodes only the Series values."],"exampleFix":"# before\nbeam.dataframe.convert.to_element_typehint(series_proxy, include_indexes=True)\n# after\nbeam.dataframe.convert.to_element_typehint(series_proxy)","handlingStrategy":"validation","validationCode":"import pandas as pd\nif isinstance(proxy, pd.Series) and include_indexes:\n    include_indexes = False  # flag is ignored for Series anyway","typeGuard":"def supports_include_indexes(proxy) -> bool:\n  import pandas as pd\n  return isinstance(proxy, pd.DataFrame)","tryCatchPattern":null,"preventionTips":["Only pass include_indexes=True with DataFrame proxies.","If index values matter for Series, reset_index() into a DataFrame first.","Suppress the known-noop flag rather than relying on silent behavior."],"tags":["python","pandas","dataframe","schema","beam"],"backgroundTag":"type-mismatch","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}