verticapy.core.tablesample.base.TableSample.decimal_to_float#
- TableSample.decimal_to_float() TableSample #
Converts all the
TableSample
decimals
tofloats
.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 1 0 40 Roger 2 1 30 Maria 3 2 22 Alisia 4 3 55 Costi Rows: 1-4 | Columns: 3Let’s use the function.
tb.decimal_to_float()
customer_ID age name 1 0 40.0 Roger 2 1 30.0 Maria 3 2 22.0 Alisia 4 3 55.0 Costi Rows: 1-4 | Columns: 3Note
All the
Decimal
are now converted tofloat
.See also