numpy基础练习
import numpy as np
#导入 numpy 包
data1 = [1,2,3,4,5]
array1 = np.array(data1)
array1
array([1, 2, 3, 4, 5])
data2 = [[1,3,5],[2,4,6]]
array2 = np.array(data2)
array2
array([[1, 3, 5],
[2, 4, 6]])
#索引和赋值
array1[2]
3
array1[1]=1
array1
array([1, 1, 3, 4, 5])