摘要: import numpy as np from pylab import * from matplotlib import pyplot as plt x = [1, 2, 3, 4] y = [3, 5, 10, 25] #创建Figure fig = plt.figure() #创建一个或多个子图(subplot绘图区才能绘图) ax1 = fig.add_subplot(231... 阅读全文
posted @ 2018-12-08 17:46 萧白白 阅读(191) 评论(0) 推荐(0) 编辑
摘要: import numpy as np A =np.arange(3,15).reshape(3,4) print(A) #第一行 print(A[2]) #返回元素 print(A[1][2]) print(A[1,2]) #返回列 print(A[:,1]) #返回行 print(A[2,:]) #返回一段元素 print(A[1,1:2]) #迭代每一行 for row in A: ... 阅读全文
posted @ 2018-12-08 13:48 萧白白 阅读(377) 评论(0) 推荐(0) 编辑
摘要: import numpy as np A = np.arange(14,2,-1).reshape((3,4)) #平均值 print(np.mean(A)) print(A.mean()) print(np.average(A)) #中位数 print(np.median(A)) #累加 print(np.cumsum(A)) #最大值和最小值 print(np.argmin(A)) pri... 阅读全文
posted @ 2018-12-08 13:48 萧白白 阅读(175) 评论(0) 推荐(0) 编辑
摘要: import numpy as np #int16和int32内存少,int64内存大但精度高 a = np.array([1,23,4],dtype=np.int32) b = np.zeros((3,4),dtype=np.int16) c = np.arange(10,20,2) #定义一个三行四列的 d = np.arange(12).reshape((3,4)) e = np.... 阅读全文
posted @ 2018-12-08 13:27 萧白白 阅读(173) 评论(0) 推荐(0) 编辑