diff --git a/pandas/core/construction.py b/pandas/core/construction.py index 9b4d67a20a7cd..aeb67129a35a0 100644 --- a/pandas/core/construction.py +++ b/pandas/core/construction.py @@ -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: @@ -783,4 +785,4 @@ def _try_cast( else: subarr = np.array(arr, dtype=dtype, copy=copy) - return subarr + return subarr \ No newline at end of file