I have this function
def dec(x):
"""Convert to Decimal and remove exponent and trailing zeros"""
if not x:
return Decimal(0)
if not isinstance(x, Decimal):
x = Decimal(str(x))
return x.quantize(Decimal(1)) if x == x.to_integral() else x.normalize()
In pandas I would do
df['price'].apply(dec)
However, dask doesn't support this so what is another way to convert a column into the decimal type?