Loading...

verticapy.core.tablesample.base.TableSample.decimal_to_float#

TableSample.decimal_to_float() TableSample#

Converts all the TableSample decimals to floats.

Returns#

TableSample

self.

Examples#

Let’s import the TableSample object:

from verticapy import TableSample

Let’s build an example object.

# Importing decimals
import decimal

# dict with all the data.
d = {
    "customer_ID": [0, 1, 2, 3],
    "age": [
        decimal.Decimal('40'),
        decimal.Decimal('30'),
        decimal.Decimal('22'),
        decimal.Decimal('55'),
    ],
    "name": ['Roger', 'Maria', 'Alisia', 'Costi'],
}


# creating the object.
tb = TableSample(d)
customer_ID
age
name
1040Roger
2130Maria
3222Alisia
4355Costi
Rows: 1-4 | Columns: 3

Let’s use the function.

tb.decimal_to_float()
customer_ID
age
name
1040.0Roger
2130.0Maria
3222.0Alisia
4355.0Costi
Rows: 1-4 | Columns: 3

Note

All the Decimal are now converted to float.

See also

TableSample.category() : Returns the category of data in a specified TableSample column.