文章目录
- 随机数据生成的方式
- list操作方式
- 数据操作方式
- 处理缺失数据
- 数据框操作方式
- 画图的方式
随机数据生成的方式
holdForce = random.uniform(10,20)
feelForce=[random.uniform(10,20) for i in range(50)]
parent=np.array(feelForce)
list操作方式
storeForce=list(range(20))
filterForce=list(filter(lambda x:x>15,storeForce))
print(filterForce)
数据操作方式
lickForce=pd.Series([1,2,3],index=['a','b','c'])
holdFroce=pd.Series({'a':1,'b':2},)
stringFroce="cqqq"
stockFroce='c' in stringFroce
print(stockFroce)
处理缺失数据
pigForce=pd.Series(random.uniform(10,20) for i in range(9))
cowForce=pd.Series(random.uniform(10,21) for i in range(10))
pigCowAdd= pigForce.add(cowForce,fill_value=0)
print(pigCowAdd)
数据框操作方式
cowForce=pd.DataFrame({'belle':["高级","中级","低级"],'magicain':[1,2,3],"land":[1,2,3]})
画图的方式
import matplotlib.pyplot as plt
x = np.linspace(-100, 100, 100)
y = np.linspace(-100, 100, 100)
plt.plot(x,y,color='blue',label='y=x')
plt.show()
x = [random.uniform(10,20) for i in range(9)]
plt.bar(np.arange(len(x)),x,align='edge',color="red")
plt.show()