xorbits.numpy.asfarray#

xorbits.numpy.asfarray(a, dtype=<class 'numpy.float64'>)#

Return an array converted to a float type.

参数
  • a (array_like) – The input array.

  • dtype (str or dtype object, optional) – Float type code to coerce input array a. If dtype is one of the ‘int’ dtypes, it is replaced with float64.

返回

out – The input a as a float ndarray.

返回类型

ndarray

实际案例

>>> 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.])

警告

This method has not been implemented yet. Xorbits will try to execute it with numpy.

This docstring was copied from numpy.