1.在python里面查看所使用的numpy的版本
import numpy as np
np.version.version
'1.19.5'
python中的各种数值类型整理
2.整型值列表—int
>>> l = list(range(10))
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> type(l[0])
<class 'int'>
3.字符串列表—str
>>> l2 = [str(c) for c in l]
>>> l2
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
>>> type(l2[0])
<class 'str'>
4.异构的列表
>>> l3 = [True,"2",3.0,4]
>>> [type(item) for item in l3]
[<class 'bool'>, <class 'str'>, <class 'float'>, <class 'int'>]
5.array数组模块
要求同一类型,否则会有浮点型
>>> np.array([3.14,4,2,3])
array([3.14, 4. , 2. , 3. ])
或者指定类型
>>> np.array([3.14,4,2,3],dtype='float32')
array([3.14, 4. , 2. , 3. ], dtype=float32)
>>> np.array([3.14,4,2,3],dtype=&#