vDataFrame.add_duplicates¶
In [ ]:
vDataFrame.add_duplicates(weight: (int, str),
use_gcd: bool = True,)
Duplicates the vDataFrame using the input weight.
Parameters¶
Name | Type | Optional | Description |
---|---|---|---|
weight | int / str | ❌ | vColumn or integer representing the weight. |
use_gcd | bool | ✓ | If set to True, uses the GCD (Greatest Common Divisor) to reduce all common weights to avoid unnecessary duplicates. |
In [4]:
from verticapy import *
names = tablesample({"name": ["Badr", "Waqas", "Pratibha"], "weight": [2, 4, 6]}).to_vdf()
display(names)
In [5]:
names.add_duplicates("weight")
Out[5]:
In [6]:
# Disabling gcd
names.add_duplicates("weight", use_gcd=False)
Out[6]: