Calmcode - patsy: operations

Operations

1 2 3 4 5 6 7 8 9

Here's the example that creates all the interaction terms.

import patsy as ps
import numpy as np

def date_to_num(date_col):
    return (date_col - date_col.min()).dt.days

y, X = ps.dmatrices("n_born ~ (date_to_num(date) + yday + month)**3 - month", df_clean)