Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataStream
  • PyFlink DataFrame
    • DataFrame
    • DataFrame Creation
    • Input/Output
    • SQL
    • DataType
    • User Defined Functions
    • Configuration
    • GPU Support
    • AI / LLM
  • PyFlink Common
  • API Reference
  • PyFlink DataFrame
  • DataFrame
  • pyflink.dataframe.dataframe.DataFrame.rename_columns

pyflink.dataframe.dataframe.DataFrame.rename_columns#

DataFrame.rename_columns(*args, mapping: Dict[str, str] | Callable[[str], str] | None = None) → DataFrame[source]#

Rename columns.

Supports multiple input formats: - Dictionary mapping old names to new names - Callable that transforms column names - Two strings for single column rename - Multiple pairs of strings for multi-column rename

Parameters:
  • *args – For column rename: - Single column: (old_name, new_name) - Multiple columns: (old1, new1, old2, new2, …)

  • mapping – Rename mapping. Can be: - Dict[str, str]: {“old_name”: “new_name”} - Callable[[str], str]: lambda name: name.upper()

Returns:

A new DataFrame with renamed columns.

Example::
>>> df.rename_columns({"a": "id", "b": "value"})
>>> df.rename_columns("a", "id")                   # Single column
>>> df.rename_columns("a", "id", "b", "value")     # Multiple columns
>>> df.rename_columns(lambda name: name.upper())   # Transform all names

previous

pyflink.dataframe.dataframe.DataFrame.filter

next

pyflink.dataframe.dataframe.DataFrame.group_by

On this page
  • DataFrame.rename_columns()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.