# %%
%pip install formulae -U
%pip install formulaic -U

# %%
import seaborn as sns
from formulae import design_matrices
from formulaic import Formula, model_matrix
import numpy as np

DATA = sns.load_dataset('iris')

design_matrix = design_matrices('sepal_length ~ C(species)*petal_width + 1', DATA)

design_matrix.data

y, X = model_matrix('sepal_length ~ species*{np.mean(petal_width)} + 1', DATA)

X.info()

sns.catplot(data=X.melt(), x='variable', y='value', hue='variable')
