I have a dataframe with multiple columns which need to be label-encoded. Problem is that the test group may include unseen data (classes) in the future. I'd like those classes to be labeled as a group of their own so that the code won't crash when I predict new data sets.
I tried using sklearn labelencoder but received.
ValueError: y contains previously unseen labels: 'rat'
I also need the encoder to be reusable, meaning that I'll be able to encode future datasets with the same values.
Is there a way to do that?