Skip to content

Commit 471abcc

Browse files
CI: Linux py37_np_dev failing on 1.0.x (#34516)
1 parent aec075b commit 471abcc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pandas/core/dtypes/cast.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
558558
object
559559
"""
560560

561-
dtype = np.object_
561+
dtype = np.dtype(np.object_)
562562

563563
# a 1-element ndarray
564564
if isinstance(val, np.ndarray):
@@ -577,7 +577,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
577577
# instead of np.empty (but then you still don't want things
578578
# coming out as np.str_!
579579

580-
dtype = np.object_
580+
dtype = np.dtype(np.object_)
581581

582582
elif isinstance(val, (np.datetime64, datetime)):
583583
val = tslibs.Timestamp(val)
@@ -588,30 +588,30 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
588588
dtype = DatetimeTZDtype(unit="ns", tz=val.tz)
589589
else:
590590
# return datetimetz as object
591-
return np.object_, val
591+
return np.dtype(np.object_), val
592592
val = val.value
593593

594594
elif isinstance(val, (np.timedelta64, timedelta)):
595595
val = tslibs.Timedelta(val).value
596596
dtype = np.dtype("m8[ns]")
597597

598598
elif is_bool(val):
599-
dtype = np.bool_
599+
dtype = np.dtype(np.bool_)
600600

601601
elif is_integer(val):
602602
if isinstance(val, np.integer):
603-
dtype = type(val)
603+
dtype = np.dtype(type(val))
604604
else:
605-
dtype = np.int64
605+
dtype = np.dtype(np.int64)
606606

607607
elif is_float(val):
608608
if isinstance(val, np.floating):
609-
dtype = type(val)
609+
dtype = np.dtype(type(val))
610610
else:
611-
dtype = np.float64
611+
dtype = np.dtype(np.float64)
612612

613613
elif is_complex(val):
614-
dtype = np.complex_
614+
dtype = np.dtype(np.complex_)
615615

616616
elif pandas_dtype:
617617
if lib.is_period(val):

pandas/core/internals/construction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def init_dict(data, index, columns, dtype=None):
233233
if missing.any() and not is_integer_dtype(dtype):
234234
if dtype is None or np.issubdtype(dtype, np.flexible):
235235
# GH#1783
236-
nan_dtype = object
236+
nan_dtype = np.dtype(object)
237237
else:
238238
nan_dtype = dtype
239239
val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype)

0 commit comments

Comments
 (0)