摘要:
均匀分布: 运行结果: 正态分布: 运行结果: 阅读全文
摘要:
""" 创建ndarray数组(linespace,arange,uniform,normal) """ import numpy as np print("linespace:", np.linspace(0, 100, 5)) # 等间隔的序列 print("arange:", np.arange(10, 50, 10)) # 每间隔10 print("uniform:", ... 阅读全文
摘要:
import numpy as np a = np.array([1, 2, 3, 4, 2, 3, 2, 4, 6, 3, 5]) print(np.unique(a)) [1 2 3 4 5 6] 阅读全文
摘要:
import numpy as np print(" 逻辑运算符 ") a = np.array([1, 2, 3, 4, 2, 3, 2, 4, 6, 3, 5]) print(a > 4) a[a > 4] = 4 print(a) print(" 三元运算符 ") print(np.where(a > 4, 0, 1)) print(np.where(np.logical_and(a > 1 阅读全文
摘要:
import numpy as np a = np.linspace(1, 16, 16).reshape(4, 4) print("a:", a) print("max:", np.max(a, axis=1)) # axis 0-列 1-行 print("min:", np.min(a, axis=0)) # axis 0-列 1-行 print("std:", np.std... 阅读全文