首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TypeError:“enumerate”对象不可调用

TypeError:“enumerate”对象不可调用
EN

Stack Overflow用户
提问于 2016-03-29 03:41:59
回答 1查看 909关注 0票数 0

我在运行我的代码时遇到一个错误。在检查了堆栈溢出中其他问题的类似错误代码后,我通过在correct_code=list[]后使用方括号对代码进行了更改,我仍然收到错误。有趣的是,这段代码在周五运行得很好,而我在周末没有接触它。

我正在用几个csv做QAQC,每个csv都包含一个字母数字物种代码列表。

代码语言:javascript
复制
Original code:
#create an array for the flagged codes to be placed
species_not_in_state = []

#make a list of the species which are found in the state   
correct_code=list(set(fire_species_code).intersection(set(state_species_code)))


#for codes which are not found in that state make a second list
for item in fire_species_code:
    if item not in correct_code:
        species_not_in_state.append(item)
print(species_not_in_state)    

3 4#中的TypeError回溯(最近一次调用)列出状态中发现的物种->5 correct_code=listset(fire_species_code).intersection(set(state_species_code)) 6 7

TypeError:“enumerate”对象不可调用

代码语言:javascript
复制
Dataset headers:
Fire_species_code:
0    AGFR
1    AGFR
2    AGFR
3    AGFR
4    AGFR
Name: Species, dtype: object

State_species_code
0    ACARO2  
1     ACSC5
2     ACSC5
3     ACSC5
4     ACSC5
Name: Symbol, dtype: object
EN

回答 1

Stack Overflow用户

发布于 2016-03-29 05:08:24

我在这里找到了问题的答案:https://wizpert.com/wizdom/python-object-is-not-callable-error

显然,我的变量名已经被使用了。Cell>All Output>Clear没有修复它,我在发布我的问题之前已经尝试过了。

Kernel>Restart &清除所有output>Restart并清除所有输出修复了我的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36269828

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档