Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion awswrangler/_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", " ", "<NA>") else None)
else:
Expand Down