File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,8 @@ def maybe_promote(dtype, fill_value=np.nan):
359
359
if isinstance (fill_value , datetime ) and fill_value .tzinfo is not None :
360
360
# Trying to insert tzaware into tznaive, have to cast to object
361
361
dtype = np .dtype (np .object_ )
362
+ elif is_integer (fill_value ) or (is_float (fill_value ) and not isna (fill_value )):
363
+ dtype = np .dtype (np .object_ )
362
364
else :
363
365
try :
364
366
fill_value = tslibs .Timestamp (fill_value ).to_datetime64 ()
Original file line number Diff line number Diff line change @@ -592,8 +592,6 @@ def test_maybe_promote_datetime64_with_any(
592
592
else :
593
593
if boxed and box_dtype is None :
594
594
pytest .xfail ("does not upcast to object" )
595
- if not boxed :
596
- pytest .xfail ("does not upcast to object or raises" )
597
595
598
596
# create array of given dtype; casts "1" to correct dtype
599
597
fill_value = np .array ([1 ], dtype = fill_dtype )[0 ]
You can’t perform that action at this time.
0 commit comments