From d5cac008a781b2829f09ae9b7942cee11c98a466 Mon Sep 17 00:00:00 2001 From: Martin Suchanek Date: Mon, 28 Sep 2020 00:31:18 -0700 Subject: [PATCH] Cast decimal as str and not string; restores fix from https://github.com/awslabs/aws-data-wrangler/pull/311 --- awswrangler/_data_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awswrangler/_data_types.py b/awswrangler/_data_types.py index ecc5abdb0..6a84c802b 100644 --- a/awswrangler/_data_types.py +++ b/awswrangler/_data_types.py @@ -491,7 +491,7 @@ def _cast_pandas_column(df: pd.DataFrame, col: str, current_type: str, desired_t df[col] = df[col].astype("string").str.encode(encoding="utf-8").replace(to_replace={pd.NA: None}) elif desired_type == "decimal": # First cast to string - df = _cast_pandas_column(df=df, col=col, current_type=current_type, desired_type="string") + df = _cast_pandas_column(df=df, col=col, current_type=current_type, desired_type="str") # Then cast to decimal df[col] = df[col].apply(lambda x: Decimal(str(x)) if str(x) not in ("", "none", "None", " ", "") else None) else: