dayofweek

In [ ]:
dayofweek(expr)

Returns the day of the week as an integer, where Sunday is day 1.

Parameters

Name Type Optional Description
expr
object
Expression.

Returns

str_sql : SQL expression.

Example

In [3]:
from verticapy import *
df = tablesample({"x": ['11-03-1993 12:00:00', '09-05-1959 03:00:00']}).to_vdf()
df["x"].astype("timestamp")
display(df)
📅
x
Timestamp
11993-11-03 12:00:00
21959-09-05 03:00:00
Rows: 1-2 | Column: x | Type: timestamp
In [4]:
# Importing the stats module
import verticapy.stats as st

# Applying the dayofweek function
df["dayofweek_x"] = st.dayofweek(df["x"])
display(df)
📅
x
Timestamp
123
dayofweek_x
Integer
11993-11-03 12:00:004
21959-09-05 03:00:007
Rows: 1-2 | Columns: 2