师傅领进门修行在个人、还是要多查资料多动手联系呀
idxn=["A", "B", "C", "D"]
cols=['YuWen','Shuxue','Yingyu','Lishi']
dfd_qz = {"YuWen": [98, 95, 95, 89],
"Shuxue": [99, 96, 78, 77],
"Yingyu": [90, 88, 98, 99] ,
"Lishi": [95, 79, 92, 90]}
dfd_qm = {"YuWen": [98, 95, 95, 89],
"Shuxue": [99, 96, 78, 77],
"Yingyu": [90, 88, 98, 99] ,
"Lishi": [95, 79, 92, 90]}
import pandas as pd
df1_qizhong = pd.DataFrame(dfd_qz,index=idxn,columns=cols)
df2_qimo = pd.DataFrame(dfd_qm,index=idxn,columns=cols)
print("如下表格依次为<期中>和<期末>成绩表:")
print(df1_qizhong)
print(df2_qimo)
print("如下顺序为<期中>和<期末>学生总成绩:")
print(df2_qimo.sum(axis=1))
print(df2_qimo.sum(axis=1))
print("如下顺序为<期中>和<期末>学生平均成绩:")
print(df2_qimo.mean (axis=1))
print(df2_qimo.mean (axis=1))