dtypes. Difference between S1 and S2 in Python

后端 未结 2 1924
[愿得一人]
[愿得一人] 2020-12-03 10:43

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\']             


        
2条回答
  •  渐次进展
    2020-12-03 11:31

    See the dtypes documentation.

    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.

提交回复
热议问题