Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions pandas/io/excel/_calamine.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import doc

import pandas as pd
from pandas.core.shared_docs import _shared_docs

from pandas.io.excel._base import BaseExcelReader
Expand Down Expand Up @@ -107,10 +106,12 @@ def _convert_cell(value: _CellValue) -> Scalar | NaTType | time:
return val
else:
return value
elif isinstance(value, (datetime, timedelta)):
# Return as-is to match openpyxl behavior (GH#59186)
return value
elif isinstance(value, date):
return pd.Timestamp(value)
elif isinstance(value, timedelta):
return pd.Timedelta(value)
# Convert date to datetime to match openpyxl behavior (GH#59186)
return datetime(value.year, value.month, value.day)
elif isinstance(value, time):
return value

Expand Down
7 changes: 1 addition & 6 deletions pandas/tests/io/excel/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ def df_ref(datapath):


def get_exp_unit(read_ext: str, engine: str | None) -> str:
unit = "us"
if read_ext == ".ods" and engine == "odf":
pass
elif (read_ext == ".ods") ^ (engine == "calamine"):
unit = "s"
return unit
return "us"


def adjust_expected(expected: DataFrame, read_ext: str, engine: str | None) -> None:
Expand Down
Loading