I have two arrays of strings:
In [51]: r['Z']
Out[51]:
array(['0', '0', '0', ..., '0', '0', '0'],
dtype='|S1')
In [52]: r['Y']
Out[52]:
array(['X0', 'X0', 'X0', ..., 'X0', 'X1', 'X1'],
dtype='|S2')
What is the difference between S1 and S2? Is it just that they hold entries of different length?
What if my arrays have strings of different lengths?
Where can I find a list of all possible dtypes and what they mean?
解决方案
The |S1 and |S2 strings are data type descriptors; the first means the array holds strings of length 1, the second of length 2. The | pipe symbol is the byteorder flag; in this case there is no byte order flag needed, so it's set to |, meaning not applicable.