names = np.array([
'Tom','Alis','Auto','Palama','Pojo',
'Dun','Pork','Havi','Dyto','Nono'
])
heights = np.array([
170.70000076, 186.70003000, 154.70000076, 178.70000076, 180.70000076, 190.70000076,
190.70000076, 177.70000076, 179.70000076, 173.70000076, 171.70000076, 168.70000076
])
print names.dtype
|S6 #S代表字符串,6代表数组中最长的字符串长度为6
print heights.dtype
float64 #float为浮点型,以64位的格式存储
print np.array([0, 1, 2, 3,4]).dtype
int64 #int为整数,以64位的格式存储
print np.array([1.0, 1.5, 3.0, 2.5]).dtype
float64 #float为浮点型,以64位的格式存储
print np.array([True, False, True]).dtype
bool #bool为布尔值
Numpy--数据类型dtype
猜你喜欢
转载自blog.csdn.net/weixin_38287297/article/details/81173709
今日推荐
周排行