Skip to content
Open
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
6 changes: 4 additions & 2 deletions pandas/core/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ def sanitize_masked_array(data: ma.MaskedArray) -> np.ndarray:
if mask.any():
dtype, fill_value = maybe_promote(data.dtype, np.nan)
dtype = cast(np.dtype, dtype)
data = ma.asarray(data.astype(dtype, copy=True))
# Incompatible types in assignment (expression has type "ndarray[Any,
# dtype[Any]]", variable has type "MaskedArray[Any, Any]")
data = data.astype(dtype, copy=True) # type: ignore[assignment]
data.soften_mask() # set hardmask False if it was True
data[mask] = fill_value
else:
Expand Down Expand Up @@ -783,4 +785,4 @@ def _try_cast(
else:
subarr = np.array(arr, dtype=dtype, copy=copy)

return subarr
return subarr