Skip to content

TYP: remove mypy ignore from pandas/core/construction.py #53112

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 5 commits into from
May 6, 2023
Merged
Changes from 4 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
12 changes: 5 additions & 7 deletions pandas/core/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,12 @@ 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)
# 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
sanitized_ma = data.astype(dtype, copy=True)
sanitized_ma.soften_mask() # set hardmask False if it was True
sanitized_ma[mask] = fill_value
return sanitized_ma
else:
data = data.copy()
return data
return data.copy()


def sanitize_array(
Expand Down