【发布时间】:2020-10-03 04:40:30
【问题描述】:
list = ['Japan', 'France', 'United States']
想要比较列表与列名地点键“国家”和值“” 仅获取与列表中的国家/地区相似的那些行
数据框如下所示:
Id Place
767 {'country_code': 'US','country': 'United States'}
645 {'country_code': 'IRL','country': 'Ireland'}
324 {'country_code': 'JAP','country': 'Japan'}
我用过这个:
for i in range(0,len(df['place'])):
df['place'][0]["country"].isin(list)
【问题讨论】:
标签: python-3.x pandas list dictionary compare