rename_columns
The rename_columns
method creates a new table with specified columns renamed.
Syntax
rename_columns(cols: Union[str, Sequence[str]]) -> Table
Parameters
Parameter | Type | Description |
---|---|---|
cols | Union[str, Sequence[str]] | Columns that will be renamed in the new table.
|
Returns
A new table that renames the specified columns.
Examples
The following example renames columns A
and C
:
from deephaven import new_table
from deephaven.column import string_col, int_col
source = new_table(
[
string_col("A", ["apple", "apple", "orange", "orange", "plum", "plum"]),
int_col("B", [1, 1, 2, 2, 3, 3]),
string_col(
"C", ["Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"]
),
int_col("D", [1, 2, 12, 3, 2, 3]),
]
)
result = source.rename_columns(cols=["Fruit = A", "Type = C"])
- source
- result