verticapy.vDataFrame.get_columns#
- vDataFrame.get_columns(exclude_columns: str | list[str] | None = None) list[str] #
Returns the vDataFrame vDataColumns.
Parameters#
- exclude_columns: SQLColumns, optional
List of the vDataColumns names to exclude from the final list.
Returns#
- List
List of all vDataFrame columns.
Examples#
Let’s begin by importing 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.Let us create a
vDataFrame
with multiple columns:vdf = vp.vDataFrame( { "col1": [1, 2, 3], "col2": [1, 2, 3], "col3": [1, 2, 3], "col4": [1, 2, 3], } )
123col1Integer100%... 123col2Integer100%123col4Integer100%1 1 ... 1 1 2 2 ... 2 2 3 3 ... 3 3 We can get the column names by:
vdf.get_columns() Out[3]: ['"col1"', '"col2"', '"col3"', '"col4"']
Some columns could also be directly excluded:
vdf.get_columns(exclude_columns = "col1") Out[4]: ['"col2"', '"col3"', '"col4"']
See also