2

Is it possible to change the stypes.int8 to stypes.int32 in python datatable?

Pasha
  • 6,298
  • 2
  • 22
  • 34
rahram
  • 560
  • 1
  • 7
  • 21

2 Answers2

3

You can easily do it:

Assume you have a DT and a field type is int32

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

and we could like to change its type from int32 to int8 as

DT['x'] = dt.int8

Here is the syntax:

DT['column'] = datatype  # (dt.int32 or dt.str32 etc etcc)
Pasha
  • 6,298
  • 2
  • 22
  • 34
myamulla_ciencia
  • 1,282
  • 1
  • 8
  • 30
  • 1
    And if you want to change ALL int8 columns into int32, then it's `DT[dt.int8] = dt.int32`. – Pasha Apr 27 '20 at 17:26
1

From the 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.

So, you can follow this link and link for Datatype conversions.

Mayank Porwal
  • 33,470
  • 8
  • 37
  • 58