我正在使用scholarly
python 中的模块来搜索关键字。我正在返回一个生成器对象,如下所示:
import pandas as pd
import numpy as np
import scholarly
search_query = scholarly.search_keyword('Python')
print(next(search_query))
{'_filled': False,
'affiliation': 'Juelich Center for Neutron Science',
'citedby': 75900,
'email': '@fz-juelich.de',
'id': 'zWxqzzAAAAAJ',
'interests': ['Physics', 'C++', 'Python'],
'name': 'Gennady Pospelov',
'url_picture': 'https://scholar.google.com/citations?view_op=medium_photo&user=zWxqzzAAAAAJ'}
我想访问元素 'citedby' 但是当我尝试这样做next(search_query)['citedby']
时返回TypeError: 'Author' object is not subscriptable
.
我的问题是如何访问生成器对象中的元素?以及如何将该对象转换为 Pandas 数据框?