dfavg=df[['IDSTUD','IDSCHOOL','avg']] dfavg.head() #把学号和成绩搞出来,然后输出保存成csv outputpath='dfavg.csv' dfavg.to_csv(outputpath,sep=',',index=False,header=True) #index=True表示保留索引 #header=True表示保留列名
//导入
file_path1 = "./dfavg.csv"
dfavg = pd.read_csv(file_path1)
dfavg.head()
#然后通过内连接的方式把dfavg和ASH连接起来
print("内连接")
dfASH_avg=pd.merge(df,dfavg,on='IDSTUD')
dfASH_avg.head()
//jupter展示1000行和1000列
pd.set_option("display.max_rows", 1000)#可显示1000行
pd.set_option("display.max_columns", 1000)#可显示1000列
标签:head,dfavg,读入,--,pd,csv,avg,1000 From: https://www.cnblogs.com/bojiandkake/p/17121330.html