rename_columns
The rename_columns method creates a new table with specified columns renamed.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| cols | Union[str, Sequence[str]] | Columns that will be renamed in the new table.
|
Important
If the new column name conflicts with an existing column name in the table, the existing column will be silently replaced.
Returns
A new table that renames the specified columns.
Examples
The following example renames columns A and C:
The following example renames column C to A. Because A already exists, it is silently replaced with the renamed C column: