Convert to float.
(self)
| 4444 | return self |
| 4445 | |
| 4446 | def __float__(self): |
| 4447 | """ |
| 4448 | Convert to float. |
| 4449 | |
| 4450 | """ |
| 4451 | if self.size > 1: |
| 4452 | raise TypeError("Only length-1 arrays can be converted " |
| 4453 | "to Python scalars") |
| 4454 | elif self._mask: |
| 4455 | warnings.warn("Warning: converting a masked element to nan.", stacklevel=2) |
| 4456 | return np.nan |
| 4457 | return float(self.item()) |
| 4458 | |
| 4459 | def __int__(self): |
| 4460 | """ |