daft.functions.week_of_year#
week_of_year #
week_of_year(expr: Expression) -> Expression
Retrieves the week of the year for a datetime column.
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Expression | a UInt32 expression with just the week_of_year extracted from a datetime column |
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
╭─────────────────────┬──────────────╮
│ datetime ┆ week_of_year │
│ --- ┆ --- │
│ Timestamp[us] ┆ UInt32 │
╞═════════════════════╪══════════════╡
│ 2024-01-01 00:00:00 ┆ 1 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2024-02-01 00:00:00 ┆ 5 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2024-12-31 00:00:00 ┆ 1 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2023-12-31 00:00:00 ┆ 52 │
╰─────────────────────┴──────────────╯
(Showing first 4 of 4 rows) Source code in daft/functions/datetime.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | |