Loading...

verticapy.vDataColumn.add_copy

vDataColumn.add_copy(name: str) vDataFrame

Adds a copy vDataColumn to the parent vDataFrame.

Parameters

name: str

Name of the copy.

Returns

vDataFrame

self._parent

Examples

import verticapy as vp

Hint

By assigning an alias to verticapy, we mitigate the risk of code collisions with other libraries. This precaution is necessary because verticapy 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 verticapy are used as intended without interfering with functions from other libraries.

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

vdf = vp.vDataFrame(
    {
        "val" : [0, 10, 20],
        "cat": ['a', 'b', 'c'],
    },
)

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

vdf["val"].add_copy("val_copy")
123
val
Integer
100%
...
Abc
cat
Varchar(1)
100%
123
val_copy
Integer
100%
10...a0
210...b10
320...c20

See also

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