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")
Iām getting āArrowInvalid: Failed to parse string: āangerā as a scalar of type int64ā error, even after specifying anger as label in the names list
Thanks for your suggestion class_encode_column, it worked.
Any idea why cast_column isnāt working in this case?
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).