On Thu, May 10, 2018 at 9:51 PM Stuart Reynolds <[email protected]>
wrote:
> np.float(scalar)
>
This actually isn't right. It's a common misconception, but np.float is an
alias to the built-in float type. You probably want np.float_(scalar)
In [5]: np.float_(12).dtype
Out[5]: dtype('float64')
In [6]: np.float is float
Out[6]: True
>
> On Thu, May 10, 2018 at 7:49 PM Hameer Abbasi <[email protected]>
> wrote:
>
>> Hello, everyone!
>>
>> I might be missing something and this might be a very stupid and
>> redundant question, but is there a way to cast a scalar to a given dtype?
>>
>> Hameer
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
[email protected]
https://mail.python.org/mailman/listinfo/numpy-discussion