Keep same dummy variable in training and testing data
You can also just get the missing columns and add them to the test dataset: # Get missing columns in the training test missing_cols = set( train.columns ) – set( test.columns ) # Add a missing column in test set with default value equal to 0 for c in missing_cols: test[c] = 0 # Ensure … Read more