Skip to content

Commit d59460c

Browse files
committed
CLN: Combine isinstance checks per review
1 parent 396737f commit d59460c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pandas/io/excel/_calamine.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,12 @@ def _convert_cell(value: _CellValue) -> Scalar | NaTType | time:
106106
return val
107107
else:
108108
return value
109-
elif isinstance(value, datetime):
110-
# Return datetime.datetime as-is to match openpyxl behavior (GH#59186)
109+
elif isinstance(value, (datetime, timedelta)):
110+
# Return as-is to match openpyxl behavior (GH#59186)
111111
return value
112112
elif isinstance(value, date):
113113
# Convert date to datetime to match openpyxl behavior (GH#59186)
114114
return datetime(value.year, value.month, value.day)
115-
elif isinstance(value, timedelta):
116-
# Return datetime.timedelta as-is to match openpyxl behavior (GH#59186)
117-
# (previously returned pd.Timedelta)
118-
return value
119115
elif isinstance(value, time):
120116
return value
121117

0 commit comments

Comments
 (0)