Hi! You are getting this error most likely because the label training is not specified as a label in the names list of the ClassLabel feature. To avoid this error, I suggest you use class_encode_column instead, which will automatically find all the unique string values in the column:
from datasets import Dataset
dataset = Dataset.from_pandas(df)
dataset = dataset.class_encode_column("Label")
Hi! Currently, only integer values support casting to the ClassLabel type hence the error. But we’ve recently added support for casting from string values, which will be available in the next release of datasets (currently only available on master if you want to try it).