#CURD
import numpy as np
data1 = np.array([1,2,3,4,5])
print(data1)
data2 = np.array([[1,2],
[3,4]])
print(data2)
#维度
print(data1.shape,data2.shape)
#ZERO ones
print(np.zeros([2,3]),np.ones([2,2]))
#改查
data2[1,0] = 5
print(data2)
print(data2[1,1])
#基本运算
data3 = np.ones([2,3])
print(data3*2)
print(data3/3)
print(data3+2)
#矩阵+*
data4 = np.array([[1,2,3],[4,5,6]])
print(data3+data4)
print(data3*data4)
tf模块matplotlib的使用
绘制柱状图
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1,2,3,4,5,6,7,8])
y = np.array([3,5,7,6,2,10,15,1])
plt.plot(x,y,'r')#折线 1 x 2 y 3color
plt.plot(x,y,'g',lw=5)# 4 linewidth
#折线 饼状 柱状
x = np.array([1,2,3,4,5,6,7,8])
y = np.array([13,25,17,36,21,16,10,15])
plt.bar(x,y,0.5,alpha=1,color = 'b')# alpha 透明度 ,0.5 宽度
plt.show()