Why is patsy used to prepare data for logistic regression? I'm pretty new to both ML &amp; scikit-learn. I've noticed that some example tutorials &amp; codes online use patsy's dmatrices to prepare data for logistic regression. I don't understand why this is done. Example
In the case above for instance, isn't it sufficient to use the data in the dataset directly to train the logistic regression model? What exactly is the point of using patsy?
Thanks!
Mostly convenience. In this particular case, it takes care of one-hot encoding categorical variables e.g. C(occupation).

patsy takes care of other things under the hood as well, like dropping rows with missing values and adding a constant intercept variable.