Loading...

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 from verticapy 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
Abc
empid
Varchar(1)
100%
...
Abc
dob
Varchar(10)
100%
123
emp_cat
Integer
100%
11...1993-01-01933
22...1988-01-01945
33...1992-01-01723
44...1989-01-01799

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.