In OneHotEncoder, use the parameter handle_unknown, it should look something like this, and now onehotencoder is auto on the dataset X, so you can remove the categorical_features or instead keep auto, removing it will solve the error:
onehotencoder = OneHotEncoder(categorical_features=[i], handle_unknown='ignore')
onehotencoder = OneHotEncoder(handle_unknown='ignore')
onehotencoder = OneHotEncoder(categorical_features=[i], handle_unknown='ignore') onehotencoder = OneHotEncoder(handle_unknown='ignore') Thanks.