How-to guides
Custom date features
Define your own functions to be used as date features
The date_features
argument of MLForecast can take pandas date
attributes as well as functions that take a pandas
DatetimeIndex
and return a numeric value. The name of the function is used as the name
of the feature, so please use unique and descriptive names.
unique_id | ds | y | dayofweek | dayofyear | even_day | month_start_or_end | is_monday | |
---|---|---|---|---|---|---|---|---|
0 | id_0 | 2000-01-01 | 0.274407 | 5 | 1 | False | True | False |
1 | id_0 | 2000-01-02 | 1.357595 | 6 | 2 | True | False | False |
2 | id_0 | 2000-01-03 | 2.301382 | 0 | 3 | False | False | True |
3 | id_0 | 2000-01-04 | 3.272442 | 1 | 4 | True | False | False |
4 | id_0 | 2000-01-05 | 4.211827 | 2 | 5 | False | False | False |
5 | id_0 | 2000-01-06 | 5.322947 | 3 | 6 | True | False | False |