dtypes. Python中S1和S2之间的区别 [英] dtypes. Difference between S1 and S2 in Python

查看:1076
本文介绍了dtypes. Python中S1和S2之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个字符串数组:

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')

S1和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?

在哪里可以找到所有可能的dtype的列表及其含义?

Where can I find a list of all possible dtypes and what they mean?

推荐答案

请参见 |S1|S2字符串是数据类型描述符;第一个表示数组包含长度为1的字符串,第二个表示长度为2的字符串.|管道符号为

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.

这篇关于dtypes. Python中S1和S2之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆