numpy.asfarray(a, dtype=)[source]
Return an array converted to a float type.
Parameters: |
a : array_like The input array. dtype : str or dtype object, optional Float type code to coerce input array |
---|---|
Returns: |
out : ndarray The input |
>>> np.asfarray([2, 3]) array([ 2., 3.]) >>> np.asfarray([2, 3], dtype='float') array([ 2., 3.]) >>> np.asfarray([2, 3], dtype='int8') array([ 2., 3.])
© 2008–2016 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.asfarray.html