Add column with a particular type in datasets

I want to add a column of type int32 to a dataset object. Currently I am using add_column()with a list of integers which leads to columns with type int64, followed by cast_column(). As I am iteratively loading a lot of datasets and then concatenating them, the above process is too slow.

I was wondering if there is a way to specify a datatype while invoking add_column() itself ?

@sgugger @lhoestq

I checked the discussion below but did not find an answer to my question.

As a workaround you can pass a numpy array with the right type

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.