我在运行我的代码时遇到一个错误。在检查了堆栈溢出中其他问题的类似错误代码后,我通过在correct_code=list[]后使用方括号对代码进行了更改,我仍然收到错误。有趣的是,这段代码在周五运行得很好,而我在周末没有接触它。
我正在用几个csv做QAQC,每个csv都包含一个字母数字物种代码列表。
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”对象不可调用
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发布于 2016-03-29 05:08:24
我在这里找到了问题的答案:https://wizpert.com/wizdom/python-object-is-not-callable-error
显然,我的变量名已经被使用了。Cell>All Output>Clear没有修复它,我在发布我的问题之前已经尝试过了。
Kernel>Restart &清除所有output>Restart并清除所有输出修复了我的问题。
https://stackoverflow.com/questions/36269828
复制相似问题