How large can a Numpy Unicode array be?
dtype = 'U100', 'U1000', 'U1000000' ?
I cannot find any reference of maximums the documentation.
How large can a Numpy Unicode array be?
dtype = 'U100', 'U1000', 'U1000000' ?
I cannot find any reference of maximums the documentation.
I found this line in https://numpy.org/doc/stable/reference/arrays.dtypes.html:
Total dtype itemsize is limited to
ctypes.c_int.
Which for 32-bit signed integer would be 2,147,483,647. But practically, the byte size of the item is also limited, so divide by 4 (Unicode code point size) is 2147483647 // 4 or 536,870,911.
>>> import numpy as np
>>> np.array(['abcdef'],dtype='U536870911')
array(['abcdef'], dtype='<U536870911')
>>> np.array(['abcdef'],dtype='U536870911').itemsize
2147483644
Also:
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.