Skip to content

Commit 54cb25e

Browse files
committed
Issue pandas-dev#30520 check for NaT values
1 parent 6a2511c commit 54cb25e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/core/common.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ def maybe_box_datetimelike(value):
8585
# turn a datetime like into a Timestamp/timedelta as needed
8686

8787
if isinstance(value, (np.datetime64, datetime)) \
88-
and not isinstance(value, tslibs.Timestamp):
88+
and not isinstance(value, tslibs.Timestamp) \
89+
and notnull(value):
8990
value = tslibs.Timestamp(value)
9091
elif isinstance(value, (np.timedelta64, timedelta)) \
91-
and not isinstance(value, tslibs.Timedelta):
92+
and not isinstance(value, tslibs.Timedelta) \
93+
and notnull(value):
9294
value = tslibs.Timedelta(value)
9395

9496
return value

0 commit comments

Comments
 (0)