Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python TypeError:只能将列表(而不是“筛选器”)连接到列表_Python_Jupyter_Conda - Fatal编程技术网

Python TypeError:只能将列表(而不是“筛选器”)连接到列表

Python TypeError:只能将列表(而不是“筛选器”)连接到列表,python,jupyter,conda,Python,Jupyter,Conda,如何修复此错误 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-10-4e1a4ac4ce1b> in <module>() ----> 1 j = NJoin(R, S)

如何修复此错误

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-4e1a4ac4ce1b> in <module>()
----> 1 j = NJoin(R, S)
      2 render_markdown(j)
      3 print(get_result(j))

/Users/mona/CS460_660/relation_algebra.py in __init__(self, op1, op2)
    164         self.common = s1.intersection(s2)
    165         self.op_str = "$\Join_{{{0}}}$".format(','.join(self.common))
--> 166         OpBase.__init__(self, op1.schema + filter(lambda x : x not in self.common, op2.schema), [op1,op2])
    167         self.count_reads = True
    168 

TypeError: can only concatenate list (not "filter") to list
下面是整个relationship_algebra.py文件:

我已经使用condacreate创建了一个py27虚拟环境,因为作者建议使用Python2.7而不是中的Python3.6 当我从jupyter笔记本执行此单元格时,我得到了上述错误: 在此之前,我在其他单元格中没有发现其他错误

我在使用Python 3.6运行代码时也遇到了同样的错误:
确认更改以下行:

OpBase.__init__(self, op1.schema + filter(lambda x : x not in self.common, op2.schema), [op1,op2])
致:


已修复此问题。

正在尝试在筛选器的哪一行周围添加列表?只有OpBase.\uuuuu init\uuuuu self,op1.schema+filterlambda x:x不在self.common,op2.schema[op1,op2]?@Avery246813579建议listfilter。。。这会解决你的问题是的。如果它修复了它,我会把它作为一个答案发布给其他人,如果他们有相同的问题,我可以找到答案!
OpBase.__init__(self, op1.schema + list(filter(lambda x : x not in self.common, op2.schema)), [op1,op2])