不可用类型错误:列表

时间:2016-09-29 10:03:56

标签: python-3.x

我有一段文字,我正在尝试使用维基百科 - iso国家/地区csv列表作为参考列出文中提到的所有国家/地区。我已经加载并将文本拆分为单词列表,并加载了wikipedia csv文件并将所需列转换为一个集合,其中包含迭代两个列表并打印一个国家的想法,如果它出现在两个列表中但我得到了不可避免的错误,下面是我的代码:

text = pd.read_sql(select_string, con)
ftext = text['SomeText'].str.split()
country_codes = pd.read_csv('wikipedia-iso-country-codes.csv')
ccs = set(country_codes['English short name lower case'])
for country in ftext:
    if country in ccs:                  #this is where the error occurs
       print(country+'  is in the text')

据我所知,行:"如果ccs中的国家:"是发生错误的地方。任何帮助都将非常感谢...谢谢。

0 个答案:

没有答案