摘要: 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 萧白白 阅读(180) 评论(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 萧白白 阅读(177) 评论(0) 推荐(0)
摘要: import numpy as np array = np.array([[1,2,3], [2,3,4]]) #打印列表 print(array)#是几维的 print('number of dim:',array.ndim)#几行几列 print('shape:',array.shape)#一共有多少个元素 print('size:',array.si... 阅读全文
posted @ 2018-12-07 17:30 萧白白 阅读(162) 评论(0) 推荐(0)
摘要: # View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontu... 阅读全文
posted @ 2018-12-07 15:14 萧白白 阅读(174) 评论(0) 推荐(0)
摘要: # View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontu... 阅读全文
posted @ 2018-12-07 14:57 萧白白 阅读(215) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import numpy as np def f(x,y): # the height function return (1 - x / 2 + x**5 + y**3) * np.exp(-x**2 -y**2) n = 256 x = np.linspace(-3, 3, n) y = np.linspace... 阅读全文
posted @ 2018-12-07 14:47 萧白白 阅读(645) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import numpy as np n = 12 X = np.arange(n) Y1 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n) Y2 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n) plt.bar(... 阅读全文
posted @ 2018-12-07 14:19 萧白白 阅读(312) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import numpy as np n = 1024 X = np.random.normal(0,1,n) Y = np.random.normal(0,1,n) T = np.arctan2(Y,X) #for color value plt.scatter(X,Y,s=75,c=T,alpha=0.5) plt.scat... 阅读全文
posted @ 2018-12-07 13:18 萧白白 阅读(208) 评论(0) 推荐(0)
摘要: # View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontu... 阅读全文
posted @ 2018-12-07 10:36 萧白白 阅读(284) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import numpy as np x=np.linspace(-3,3,50) y1=x*2+1 y2=x**2 plt.plot(x,y1) plt.figure(num=3,figsize=(8,5)) plt.plot(x,y2) plt.plot(x,y1,color="red",linewidth=1.0,line... 阅读全文
posted @ 2018-12-06 17:54 萧白白 阅读(305) 评论(0) 推荐(0)