vDataFrame[].get_dummies¶
In [ ]:
vDataFrame[].get_dummies(prefix: str = "",
prefix_sep: str = "_",
drop_first: bool = True,
use_numbers_as_suffix: bool = False)
Encodes the vcolumn using the One Hot Encoding algorithm.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
prefix | str | ✓ | Prefix of the dummies. |
prefix_sep | str | ✓ | Prefix delimitor of the dummies. |
drop_first | bool | ✓ | Drops the first dummy to avoid the creation of correlated features. |
use_numbers_as_suffix | bool | ✓ | Uses numbers as suffix instead of the vcolumns categories. |
In [79]:
from verticapy import vDataFrame
churn = vDataFrame("public.churn")
churn = churn.select(["InternetService", "MonthlyCharges", "churn"])
display(churn)
In [78]:
churn["InternetService"].get_dummies()
Out[78]:
In [80]:
# Number as suffix
churn["InternetService"].get_dummies(use_numbers_as_suffix = True)
Out[80]:
See Also¶
| vDataFrame[].decode | Encodes the vcolumn using a user defined Encoding. |
| vDataFrame[].discretize | Discretizes the vcolumn. |
| vDataFrame[].label_encode | Encodes the vcolumn using the Label Encoding. |
| vDataFrame[].mean_encode | Encodes the vcolumn using the Mean Encoding of a response. |
