Loading...

vastorbit.VastColumn.add_copy

VastColumn.add_copy(name: str) VastFrame

Adds a copy VastColumn to the parent VastFrame.

Parameters:

name (str) – Name of the copy.

Returns:

self._parent

Return type:

VastFrame

Examples

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 from vastorbit are used as intended without interfering with functions from other libraries.

Let us create a dummy dataset and copy one of its columns:

vdf = vo.VastFrame(
    {
        "val" : [0, 10, 20],
        "cat": ['a', 'b', 'c'],
    },
)
123
val
Integer
Abc
cat
Varchar(1)
110b
220c
30a
Rows: 1-3 | Columns: 2

We can copy the “val” column, and name the new column:

vdf["val"].add_copy("val_copy")
123
val
Integer
Abc
cat
Varchar(1)
123
val_copy
Integer
110b10
20a0
320c20
Rows: 1-3 | Columns: 3

See also

VastFrame.info() : Displays information about the different VastFrame transformations