'How to use cast_column in Huggingface datasets

I am trying to use the cast_column method, but don't see any examples how to do it, nor can I successfully pass the right parameters to it. The first parameter is the column (or feature) name which is straightforward. The second parameter is something of FeatureType, which I don't think I quite get or I am not passing in the correct thing.

So for example I might try:

import pyarrow as pa
ds.cast_column('label', pa.int64())

which would give me

TypeError 'pyarrow.lib.DataType' object is not callable

So what should that second parameter look like, or am I going about things completely the wrong way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source