There seems to be a subtle difference between numpy.float and numpy.float64.
>>> import numpy as np
>>> isinstance(2.0, np.float)
True
>>> isinstance(2.0, np.float64)
False
Can someone clarify this? Thanks
np.float is an alias for python float type. 
np.float32 and np.float64 are numpy specific 32 and 64-bit float types.
float?
Init signature: float(self, /, *args, **kwargs)
Docstring:     
float(x) -> floating point number
Convert a string or number to a floating point number, if possible.
Type:           type
np.float?
Init signature: np.float(self, /, *args, **kwargs)
Docstring:     
float(x) -> floating point number
Convert a string or number to a floating point number, if possible.
Type:           type
np.float32?
Init signature: np.float32(self, /, *args, **kwargs)
Docstring:      32-bit floating-point number. Character code 'f'. C float compatible.
File:           c:\python\lib\site-packages\numpy\__init__.py
Type:           type
np.float64?
Init signature: np.float64(self, /, *args, **kwargs)
Docstring:      64-bit floating-point number. Character code 'd'. Python float compatible.
File:           c:\python\lib\site-packages\numpy\__init__.py
Type:           type
Thus, when you do isinstance(2.0, np.float), it is equivalent to isinstance(2.0, float) as 2.0 is a plain python built-in float type... and not the numpy type.
isinstance(np.float64(2.0), np.float64) would obviously be True.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With