vastorbit.VastColumn.rename¶
- VastColumn.rename(new_name: str, inplace: bool = True) VastFrame¶
Renames the VastColumn. This function is not directly applied to the input object.
Warning
SQL code generation will be slower if the
VastFramehas been transformed multiple times, so it’s better to use this method when first preparing your data. It is even recommended to use theVastFrame.select()method directly and perform all renaming within a single operation.- Parameters:
new_name (str) – The new VastColumn alias.
inplace (bool, optional) – If set to
True, theVastFrameis replaced with the new relation.
- Returns:
result.
- Return type:
Examples
Let’s begin by importing vastorbit.
import vastorbit as vo
Hint
By assigning an alias to
vastorbit, we mitigate the risk of code collisions with other libraries. This precaution is necessary because vastorbit uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions fromvastorbitare used as intended without interfering with functions from other libraries.Let us create a dummy dataset and rename one of its columns:
vdf = vo.VastFrame( { "val" : [0, 10, 20], "cat": ['a', 'b', 'c'], }, )
123valIntegerAbccatVarchar(1)1 10 b 2 20 c 3 0 a Rows: 1-3 | Columns: 2We can copy the “val” column, and name the new column:
vdf["val"].rename("value")
AbccatVarchar(1)123valueInteger1 a 0 2 b 10 3 c 20 Rows: 1-3 | Columns: 2See also