[英]TypeError: 'builtin_function_or_method' is not iterable
I have the code below: 我有下面的代码:
import sys
import pandas as pd
matrix = pd.read_table('testGEM.txt')
ID = pd.read_table('test_transcripts.txt', header = None)
ls = ID.values.tolist()
list=[]
for sublist in id:
for item in sublist:
list.append(item)
id = tuple(list)
x = matrix[matrix.index.isin(id)]
x.to_csv('test10.out',sep='\t')
However, when I run the code, I got a problem saying: 但是,当我运行代码时,出现一个问题:
Traceback (most recent call last):
File "map.py", line 7, in <module>
for sublist in id:
TypeError: 'builtin_function_or_method' object is not iterable
Does anyone have any idea where is the problem? 有人知道问题出在哪里吗?
In python, id
is a built in function described below. 在python中, id
是下面描述的内置函数。 You probably wanted to iterate over ID
in your case instead. 您可能想在您的案例中遍历ID
。
https://docs.python.org/2/library/functions.html#id https://docs.python.org/2/library/functions.html#id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.