datatable.time.day_of_week()

Added in version 1.0.0

For a given date column compute the corresponding days of week.

Days of week are returned as integers from 1 to 7, where 1 represents Monday, and 7 is Sunday. Thus, the return value of this function matches the ISO standard.

Parameters

date
FExpr[date32] | FExpr[time64]

The date32 (or time64) column for which you need to calculate days of week.

return
FExpr[int32]

An integer column, with values between 1 and 7 inclusive.

Examples

DT = dt.Frame([18000, 18600, 18700, 18800, None], stype='date32') DT[:, {"date": f[0], "day-of-week": dt.time.day_of_week(f[0])}]
dateday-of-week
date32int32
02019-04-147
12020-12-045
22021-03-147
32021-06-222
4NANA