【发布时间】:2020-12-22 14:41:50
【问题描述】:
【问题讨论】:
【问题讨论】:
我会做以下事情:
#use the Pandas library
import pandas as pd
#read in the data
data = pd.read_csv('file.csv') #read in the data
#add a new column that is 1 if 'Engineer' appears in the Subject Field, else 0
data['isEngineeringRelated']=data['Subject Field'].map(lambda x: 1 if 'Engineer' in x else 0)
#filter for engineering rows
engineering_data = data[data['isEngineeringRelated']==1]
#groupby the engineering fields and count the average number of papers of authors in that field
print(engineering_data.groupby('Subject Field')['Number of Papers'].mean())
我不确定您所说的“在字段信息中显示该表以及所有作者”到底是什么意思 - 但也许这段代码可以帮助您入门。
顺便说一句,我同意 Celius 的评论 - 一般来说,分享示例数据集并描述您已经尝试过的内容会有所帮助。
【讨论】: