def he(a,b,c) : #调用函数,带有参数
return a+b+c #返回和
def junzhi(a,b,c) :
return he(a,b,c)/3
print(junzhi(1,2,3))
newdata = {"lang":{"firstline":"python","secondline":"java"}, "price":{"firstline":8000}}
print(newdata) #打印字典
from pandas import DataFrame
f4 = DataFrame(newdata) #定义f4
print(f4)
f4 = DataFrame(newdata, index=["firstline","secondline","thirdline"]) #修改行标题
print(f4)
from pandas import Series,DataFrame
newdata1 = {'username':{'first':'wangxing','second':'dadiao'}}
f6 = DataFrame(newdata1, columns=['username', 'age', 'sex']) #修改列标题
f6['sex'] = 'man' #统一给列赋值
sex = Series(['男','女'],index=['first','second']) #点对点赋值,先定义好在放进去
f6['sex'] = sex
f6['age']['second'] = 30 #定位赋值
print(f6)
import pandas as pd
obj = pd.Series([1,2,5,7])
print(obj[obj>3])
obj.index = ["王","张","乔","冯"]
print(obj)
import numpy as np
x_value = np.random.randint(140, 180, 200)
import matplotlib.pyplot as plt
plt.hist(x_value, bins=10)
plt.title("data analyze")
plt.xlabel("height")
plt.ylabel("rate")
plt.show()