有人能帮我吗。我试图从一个数据框架(从Json加载)中找到拥有最多项目的前10个国家
我使用了这个查询:json_df.groupby('countrycode').max()
,但这会导致多行,不知道为什么。以下是我的专栏:
Index(['_id', 'approvalfy', 'board_approval_month', 'boardapprovaldate',
'borrower', 'closingdate', 'country_namecode', 'countrycode',
'countryname', 'countryshortname', 'docty', 'envassesmentcategorycode',
'grantamt', 'ibrdcommamt', 'id', 'idacommamt', 'impagency',
'lendinginstr', 'lendinginstrtype', 'lendprojectcost',
'majorsector_percent', 'mjsector_namecode', 'mjtheme',
'mjtheme_namecode', 'mjthemecode', 'prodline', 'prodlinetext',
'productlinetype', 'project_abstract', 'project_name', 'projectdocs',
'projectfinancialtype', 'projectstatusdisplay', 'regionname', 'sector',
'sector1', 'sector2', 'sector3', 'sector4', 'sector_namecode',
'sectorcode', 'source', 'status', 'supplementprojectflg', 'theme1',
'theme_namecode', 'themecode', 'totalamt', 'totalcommamt', 'url'])
试试这个:
它给出的输出显示了有多少个项目与每个countrycode相关
相关问题 更多 >
编程相关推荐