Weekday as dummy / factor variable in a linear regression model using statsmodels
问题 The question: How can I add a dummy / factor variable to a model using sm.OLS() ? The details Below is a reproducible dataframe that you can pick up using ctrl + C and then run the snippet further down for a reproducible example. Input data: Date A B weekday 2013-05-04 25.03 88.51 Saturday 2013-05-05 52.98 67.99 Sunday 2013-05-06 39.93 75.19 Monday 2013-05-07 47.31 86.99 Tuesday 2013-05-08 19.61 87.94 Wednesday 2013-05-09 39.51 83.10 Thursday 2013-05-10 21.22 62.16 Friday 2013-05-11 19.04 58