How does numpy determine the array data type when it contains multiple dtypes?
我正在尝试动手numpy,当我跨越以下数据类型时
使用内置方法dtype。以下是我得到的一些结果。
你能解释一下u11的意思吗
1 2 | a1 = np.array([3,5,'p']) print(a1.dtype) |
o / p => U11
现在,关于
1 2 3 4 5 6 7 8 | In [45]: a1.dtype Out[45]: dtype('<U21') # 64bit Linux In [46]: a1.dtype.type # The type object used to instantiate a scalar of this data-type. Out[46]: numpy.str_ In [49]: a1.dtype.itemsize Out[49]: 84 # 21 * 4 |
阅读文档https://docs.scipy.org/doc/numpy-1.14.0/reference/arrays.dtypes.html#data-type-objects-dtype中有关字符串类型和其他数据类型对象的更多详细信息,以了解更多信息。