add features: ['labels'] to a Datadict from pandas dataframe

26 views Asked by At

I have atraining dataset of images DatasetDict({train: Dataset({features: ['image'],num_rows: 900})}) and I want to add features: ['image', 'label'], where the values of the label are saved in a csv or pandas Dataframe.

I created the new column new_column_name = 'labels' train_dataset = train_dataset.map(lambda example: {new_column_name:'a', **example}) but I cannot assign train_dataset['train'][i]['labels'] = labels['label'].iloc

0

There are 0 answers