File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ def maybe_promote(dtype, fill_value=np.nan):
352
352
# We treat string-like dtypes as object, and _always_ fill
353
353
# with np.nan
354
354
fill_value = np .nan
355
+ dtype = np .dtype (np .object_ )
355
356
356
357
# returns tuple of (dtype, fill_value)
357
358
if issubclass (dtype .type , np .datetime64 ):
@@ -424,8 +425,6 @@ def maybe_promote(dtype, fill_value=np.nan):
424
425
# in case we have a string that looked like a number
425
426
if is_extension_array_dtype (dtype ):
426
427
pass
427
- elif is_datetime64tz_dtype (dtype ):
428
- pass
429
428
elif issubclass (np .dtype (dtype ).type , (bytes , str )):
430
429
dtype = np .object_
431
430
Original file line number Diff line number Diff line change @@ -332,18 +332,17 @@ def test_maybe_promote_any_with_datetime64(
332
332
dtype = np .dtype (any_numpy_dtype_reduced )
333
333
boxed , box_dtype = box # read from parametrized fixture
334
334
335
- if is_datetime64_dtype (dtype ):
336
- if boxed and (
337
- box_dtype == object
338
- or (box_dtype is None and not is_datetime64_dtype (type (fill_value )))
339
- ):
340
- pytest .xfail ("falsely upcasts to object" )
341
- else :
342
- if boxed and (
343
- box_dtype == "dt_dtype"
344
- or (box_dtype is None and is_datetime64_dtype (type (fill_value )))
345
- ):
346
- pytest .xfail ("mix of lack of upcasting, resp. wrong missing value" )
335
+ if boxed :
336
+ if is_datetime64_dtype (dtype ):
337
+ if box_dtype == object :
338
+ pytest .xfail ("falsely upcasts to object" )
339
+ elif box_dtype is None and not is_datetime64_dtype (type (fill_value )):
340
+ pytest .xfail ("falsely upcasts to object" )
341
+ else :
342
+ if box_dtype == "dt_dtype" :
343
+ pytest .xfail ("mix of lack of upcasting, resp. wrong missing value" )
344
+ elif box_dtype is None and is_datetime64_dtype (type (fill_value )):
345
+ pytest .xfail ("mix of lack of upcasting, resp. wrong missing value" )
347
346
348
347
# special case for box_dtype
349
348
box_dtype = np .dtype (datetime64_dtype ) if box_dtype == "dt_dtype" else box_dtype
You can’t perform that action at this time.
0 commit comments