machinalis / mypy-data

mypy typesheds for the Python data stack
BSD 3-Clause "New" or "Revised" License
86 stars 23 forks source link

Getting scalars from numpy arrays #24

Open joshua-cogliati-inl opened 6 years ago

joshua-cogliati-inl commented 6 years ago

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