From 514f4e7aab31307c7caacbdebb2ceedd4c637e2f Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Wed, 6 Dec 2023 05:20:16 -0500 Subject: [PATCH] chore(pandas-data): decimal conversion --- ibis/formats/pandas.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ibis/formats/pandas.py b/ibis/formats/pandas.py index 4355013d6000e..87c5411881199 100644 --- a/ibis/formats/pandas.py +++ b/ibis/formats/pandas.py @@ -161,6 +161,15 @@ def convert_Boolean(s, dtype, pandas_type): else: return s + @staticmethod + def convert_Decimal(s, dtype, pandas_type): + import decimal + + import pyarrow as pa + + arr = pa.array(s.map(decimal.Decimal, na_action="ignore").values) + return arr.cast(dtype.to_pyarrow(), safe=False) + @staticmethod def convert_Timestamp(s, dtype, pandas_type): if isinstance(dtype, pd.DatetimeTZDtype):