Hello all, say I have a dataset with 2000 entries
dataset = Dataset.from_dict({‘colA’: list(range(2000))})
and from which I want to extract the first one thousand rows, create a new dataset with these and also add a new column to it:
dataset2 = dataset.select(list(range(1000)))
final_dataset = dataset2.add_column(‘colB’, list(range(1000)))
This gives an error
ArrowInvalid: Added column’s length must match table’s length. Expected length 2000 but got length 1000
I’ve experimented with the arguments of the select method, but I did not find a way to surpass this error. Does anyone know why it’s happening and how to resolve it?
Thanks.