Dataset features Encoding and Scaling
To tackle your problem of having some unique values in the test set that are not in the training set, you can try to do the following :

Merge the training dataset using df = train.append(test)
Apply the encodings that you have used earlier
Split the datasets back into train and test using :


train = df.head(len(train))

test = df.tail(len(test))


Based on my experience I can say that LabelEncoding and OneHotEncoding are some of the best techniques to encode non-ordinal features.
Hope this was helpful :)
I have a dataset with non-ordinal categorical features. What is the best way to transform them (encoding + scaling) before training the machine learning model (Linear SVC)?
Things I tried:

Label Encoding - This works. But scaling doesn't make sense as different categories in a feature don't have any specific order.

One-Hot encoding - There are thousand's of unique categories in a features, which is making the ML model complex by creating thousands of columns.

Count encoding - My train-test split didn't have all unique categories of a feature in the training set, which introduces NaN's in test set when I count-encode those features.


Appreciate your help!