verticapy.vDataColumn.drop#
- vDataColumn.drop(add_history: bool = True) vDataFrame #
Drops the vDataColumn from the vDataFrame. Dropping a vDataColumn means it is not selected in the final generated SQL code.
Warning
Dropping a vDataColumn can make the vDataFrame “heavier” if it is used to compute other vDataColumns.
Parameters#
- add_history: bool, optional
If set to True, the information is stored in the vDataFrame history.
Returns#
- vDataFrame
self._parent
Examples#
We import
verticapy
: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 fromverticapy
are used as intended without interfering with functions from other libraries.For this example, we will use a dummy dataset with three columns:
vdf = vp.vDataFrame( { "col1": [1, 2, 3], "col2": [3, 3, 1], "col":['a', 'b', 'v'], }, )
123col1Integer100%... 123col2Integer100%AbccolVarchar(1)100%1 1 ... 3 a 2 2 ... 3 b 3 3 ... 1 v Note
VerticaPy offers a wide range of sample datasets that are ideal for training and testing purposes. You can explore the full list of available datasets in the Datasets, which provides detailed information on each dataset and how to use them effectively. These datasets are invaluable resources for honing your data analysis and machine learning skills within the VerticaPy environment.
Using
drop
we can take out any column that we do not need:vdf["col1"].drop() Out[3]: None col2 col 1 3 a 2 3 b 3 1 v Rows: 3 | Columns: 2
123col2Integer100%AbccolVarchar(1)100%1 3 a 2 3 b 3 1 v See also
vDataColumn.
drop()
: Drops the input vDataColumn.vDataFrame.
drop_duplicates()
: Drops the vDataFrame duplicates.