Skip to content

Fixed issue with writing Decimal type to excel file - Issue #49598 #50174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
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
4 changes: 4 additions & 0 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import abc
import datetime
from decimal import Decimal
from functools import partial
from io import BytesIO
import os
Expand Down Expand Up @@ -48,6 +49,7 @@

from pandas.core.dtypes.common import (
is_bool,
is_decimal,
is_float,
is_integer,
is_list_like,
Expand Down Expand Up @@ -1368,6 +1370,8 @@ def _value_with_fmt(self, val) -> tuple[object, str | None]:
val = int(val)
elif is_float(val):
val = float(val)
elif is_decimal(val):
val = Decimal(val)
elif is_bool(val):
val = bool(val)
elif isinstance(val, datetime.datetime):
Expand Down