From 68e505848e5d1403ddcc10a054797b7cdd8cd25f Mon Sep 17 00:00:00 2001 From: Dylan Hercher Date: Thu, 25 Aug 2022 07:01:29 -0700 Subject: [PATCH] bug: add infered integer to pandas type cast and default to decimal (#567) --- third_party/ibis/ibis_addon/datatypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/ibis/ibis_addon/datatypes.py b/third_party/ibis/ibis_addon/datatypes.py index bae47d7cf..9a5aba3a8 100644 --- a/third_party/ibis/ibis_addon/datatypes.py +++ b/third_party/ibis/ibis_addon/datatypes.py @@ -45,6 +45,7 @@ # mixed-integer-float, complex, categorical, timedelta64, timedelta, period IBIS_TYPE_TO_PANDAS_TYPE[dt.Decimal(10, 0)] = np.dtype(decimal.Decimal) _inferable_pandas_dtypes["decimal"] = dt.Decimal(10, 0) +_inferable_pandas_dtypes["integer"] = dt.int32 _inferable_pandas_dtypes["date"] = dt.date _inferable_pandas_dtypes["datetime64"] = dt.timestamp @@ -86,7 +87,7 @@ def infer_pandas_schema_incl_decimals(df, schema=None): ) elif inferred_dtype == "floating": inferred_dtype = "decimal" - ibis_dtype = _inferable_pandas_dtypes[inferred_dtype] + ibis_dtype = _inferable_pandas_dtypes.get(inferred_dtype, dt.Decimal(10, 0)) else: ibis_dtype = dt.dtype(pandas_dtype)