# create dummy variables for the months years = int(len(CBE.elec_log)/12) CBE.loc[:, 'Month'] = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] * years dummies = pd.get_dummies(CBE.loc[:, 'Month']) CBE[list(dummies.columns)] = dummies # print the head of the data frame to look at the dummy variables. CBE.head(12)