2024-09-30 12:11:31 发布
网友
Numpy Unicode数组可以有多大
dtype = 'U100', 'U1000', 'U1000000'
我找不到有关文档的任何参考资料
我在https://numpy.org/doc/stable/reference/arrays.dtypes.html中找到了这一行:
Total dtype itemsize is limited to ctypes.c_int.
ctypes.c_int
对于32位有符号整数,其值为2147483647。但实际上,项的字节大小也是有限的,因此除以4(Unicode代码点大小)就是2147483647 // 4或536870911
2147483647 // 4
>>> import numpy as np >>> np.array(['abcdef'],dtype='U536870911') array(['abcdef'], dtype='<U536870911') >>> np.array(['abcdef'],dtype='U536870911').itemsize 2147483644
此外:
dtype.itemsizeThe element size of this data-type object.For 18 of the 21 types this number is fixed by the data-type. For the flexible data-types, this number can be anything.
dtype.itemsize
The element size of this data-type object.
For 18 of the 21 types this number is fixed by the data-type. For the flexible data-types, this number can be anything.
我在https://numpy.org/doc/stable/reference/arrays.dtypes.html中找到了这一行:
对于32位有符号整数,其值为2147483647。但实际上,项的字节大小也是有限的,因此除以4(Unicode代码点大小)就是
2147483647 // 4
或536870911此外:
相关问题 更多 >
编程相关推荐