from mlforecast import MLForecast
from mlforecast.utils import generate_daily_series

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.

series = generate_daily_series(1, min_length=6, max_length=6)
def even_day(dates):
    """Day of month is even"""
    return dates.day % 2 == 0

def month_start_or_end(dates):
    """Date is month start or month end"""
    return dates.is_month_start | dates.is_month_end

def is_monday(dates):
    """Date is monday"""
    return dates.dayofweek == 0
fcst = MLForecast(
    [],
    freq='D',
    date_features=['dayofweek', 'dayofyear', even_day, month_start_or_end, is_monday]
)
fcst.preprocess(series)
unique_iddsydayofweekdayofyeareven_daymonth_start_or_endis_monday
0id_02000-01-010.27440751FalseTrueFalse
1id_02000-01-021.35759562TrueFalseFalse
2id_02000-01-032.30138203FalseFalseTrue
3id_02000-01-043.27244214TrueFalseFalse
4id_02000-01-054.21182725FalseFalseFalse
5id_02000-01-065.32294736TrueFalseFalse