Loading...

vastorbit.VastFrame.bool_to_int

VastFrame.bool_to_int() VastFrame

Converts all booleans VastColumns to integers.

Returns:

self

Return type:

VastFrame

Examples

We import vastorbit:

import vastorbit as vo

Hint

By assigning an alias to vastorbit, we mitigate the risk of code collisions with other libraries. This precaution is necessary because vastorbit uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions from vastorbit are used as intended without interfering with functions from other libraries.

Let’s create a small dataset:

data = vo.VastFrame(
    {
        "empid": ['1', '2', '3', '4'],
        "is_temp": [True, False, False, True],
    }
)
data
Abc
empid
Varchar(1)
0|1
is_temp
Boolean
14
23
32
41
Rows: 1-4 | Columns: 2

Let’s change the data type from bool to int.

data.bool_to_int()
Abc
empid
Varchar(1)
123
is_temp
Integer
130
241
320
411
Rows: 1-4 | Columns: 2