Skip to content

Commit 533d841

Browse files
committed
rename data
1 parent 6a18b99 commit 533d841

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/core/construction.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ def sanitize_masked_array(data: ma.MaskedArray) -> np.ndarray:
502502
if mask.any():
503503
dtype, fill_value = maybe_promote(data.dtype, np.nan)
504504
dtype = cast(np.dtype, dtype)
505-
data = ma.asarray(data.astype(dtype, copy=True))
506-
data.soften_mask() # set hardmask False if it was True
507-
data[mask] = fill_value
505+
sanitized_ma = data.astype(dtype, copy=True)
506+
sanitized_ma.soften_mask() # set hardmask False if it was True
507+
sanitized_ma[mask] = fill_value
508+
return sanitized_ma
508509
else:
509-
data = data.copy()
510-
return data
510+
return data.copy()
511511

512512

513513
def sanitize_array(

0 commit comments

Comments
 (0)