Convert this array into a numpy.ma.MaskedArray Parameters ---------- copy : bool, default: True If True make a copy of the array in the result. If False, a MaskedArray view of DataArray.values is returned. Returns ------- resu
(self, copy: bool = True)
| 4042 | return pd.Series(self.values.reshape(-1), index=index, name=self.name) |
| 4043 | |
| 4044 | def to_masked_array(self, copy: bool = True) -> np.ma.MaskedArray: |
| 4045 | """Convert this array into a numpy.ma.MaskedArray |
| 4046 | |
| 4047 | Parameters |
| 4048 | ---------- |
| 4049 | copy : bool, default: True |
| 4050 | If True make a copy of the array in the result. If False, |
| 4051 | a MaskedArray view of DataArray.values is returned. |
| 4052 | |
| 4053 | Returns |
| 4054 | ------- |
| 4055 | result : MaskedArray |
| 4056 | Masked where invalid values (nan or inf) occur. |
| 4057 | """ |
| 4058 | values = self.to_numpy() # only compute lazy arrays once |
| 4059 | isnull = pd.isnull(values) |
| 4060 | return np.ma.MaskedArray(data=values, mask=isnull, copy=copy) |
| 4061 | |
| 4062 | # path=None writes to bytes |
| 4063 | @overload |