MCPcopy Create free account
hub / github.com/numpy/numpy / __float__

Method __float__

numpy/ma/core.py:4446–4457  ·  view source on GitHub ↗

Convert to float.

(self)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 2

warnMethod · 0.80
itemMethod · 0.80

Tested by

no test coverage detected