verticapy.vDataFrame.datecol#
- vDataFrame.datecol() list #
Returns a list of the vDataColumns of type date in the vDataFrame.
Returns#
- List
List of all vDataColumns of type date.
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.Let’s create a small dataset:
data = vp.vDataFrame( { "empid": ['1', '2', '3', '4'], "dob": ['1993-01-01', '1988-01-01', '1992-01-01', '1989-01-01'], "doj": ['2022-01-01', '2023-01-01', '2022-01-01', '2023-01-01'], "emp_cat":[933, 945, 723, 799], } ) data
AbcempidVarchar(1)100%... AbcdobVarchar(10)100%123emp_catInteger100%1 1 ... 1993-01-01 933 2 2 ... 1988-01-01 945 3 3 ... 1992-01-01 723 4 4 ... 1989-01-01 799 Let’s set the data type of dob and doj to date.
data["dob"].astype("date") data["doj"].astype("date")
Let’s retrieve the date type vcolumns in the dataset.
data.datecol() Out[2]: ['"dob"', '"doj"']
See also
vDataFrame.
catcol()
: Returns all vDataColumns with categorical values.vDataFrame.
numcol()
: Returns all vDataColumns with numerical values.vDataFrame.
get_columns()
: Returns all vDataColumns.