How to predict custom value after using linear regression?
As an alternative to pd.dummies() you could use sklearn.preprocessing.OneHotEncoder().The advantage here would be that after creating an encoder object you can reuse it to transform data points you have to the one hot form. You could use OneHotEncoder(categories) to manually assign categories for the encoder object or you could use OneHotEncoder.fit() to extract categories from a particular feature. You can then use OneHotEncoder.transform(feature) to transform it to one hot form. pd.dummies() does not provide the re usability part, therefore, sklearn.OneHotEncoder() makes things simpler.