mypy-data icon indicating copy to clipboard operation
mypy-data copied to clipboard

Getting scalars from numpy arrays

Open joshua-cogliati-inl opened this issue 6 years ago • 0 comments

Getting a scalar from a numpy array does not seem to be supported.

import numpy
b : float = float(numpy.array(1))

with mypy gets the error:

error: Argument 1 to "float" has incompatible type "ndarray[Any]"; expected "Union[SupportsFloat, str, bytes]"

joshua-cogliati-inl avatar Jul 03 '18 20:07 joshua-cogliati-inl