更改 python 数据表中的列类型

change type of columns in python Datatable

是否可以在 python datatable 中将 stypes.int8 更改为 stypes.int32

来自Datatable docs

As the name suggests, the package is closely related to R's data.table and attempts to mimic its core algorithms and API.

因此,您可以按照此 link and 进行数据类型转换。

你可以轻松做到:

假设你有一个 DT 并且字段类型是 int32

DT = dt.Frame({'x': [1,2,3,4,5]})

并且我们希望将其类型从 int32 更改为 int8 as

DT['x'] = dt.int8

语法如下:

DT['column'] = datatype  # (dt.int32 or dt.str32 etc etcc)