Skip to content

CI: Linux py37_np_dev failing on 1.0.x #34516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
object
"""

dtype = np.object_
dtype = np.dtype(np.object_)

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

dtype = np.object_
dtype = np.dtype(np.object_)

elif isinstance(val, (np.datetime64, datetime)):
val = tslibs.Timestamp(val)
Expand All @@ -588,30 +588,30 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False):
dtype = DatetimeTZDtype(unit="ns", tz=val.tz)
else:
# return datetimetz as object
return np.object_, val
return np.dtype(np.object_), val
val = val.value

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

elif is_bool(val):
dtype = np.bool_
dtype = np.dtype(np.bool_)

elif is_integer(val):
if isinstance(val, np.integer):
dtype = type(val)
dtype = np.dtype(type(val))
else:
dtype = np.int64
dtype = np.dtype(np.int64)

elif is_float(val):
if isinstance(val, np.floating):
dtype = type(val)
dtype = np.dtype(type(val))
else:
dtype = np.float64
dtype = np.dtype(np.float64)

elif is_complex(val):
dtype = np.complex_
dtype = np.dtype(np.complex_)

elif pandas_dtype:
if lib.is_period(val):
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def init_dict(data, index, columns, dtype=None):
if missing.any() and not is_integer_dtype(dtype):
if dtype is None or np.issubdtype(dtype, np.flexible):
# GH#1783
nan_dtype = object
nan_dtype = np.dtype(object)
else:
nan_dtype = dtype
val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype)
Expand Down