numpy.result_type#
- numpy.result_type(*arrays_and_dtypes)#
返回通过将 NumPy 类型提升规则应用于参数所得到的结果类型。
- 参数:
- arrays_and_dtypes数组和数据类型的列表
某个操作的运算数,其结果类型是必需的。
- 返回:
- outdtype
结果类型。
另请参阅
示例
>>> import numpy as np >>> np.result_type(3, np.arange(7, dtype='i1')) dtype('int8')
>>> np.result_type('i4', 'c8') dtype('complex128')
>>> np.result_type(3.0, -2) dtype('float64')