2017-09-21 15 views
-1

このエラーを解決するにはどうすればよいですか?著者は、私がこれを実行するとhttps://github.com/HazyResearch/cs145-notebooks-2016/tree/master/lecture-16 のようにPython3.6をPython2.7をいない使用することを示唆しているので、私はcondaが作成使用してpy27仮想環境を作成している https://pastebin.com/Nwuddb77TypeError:リストに連結できるのはリスト(フィルタではない)のみです

--------------------------------------------------------------------------- 
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 

は、ここで全体relation_algebra.pyファイルですjupyterノートブックからのセルは、私は上記のエラーを取得する: 私はその enter image description here

前に、他のセル内の他のエラーを取得していない私は、同じ電子を持っていました私もPythonの3.6でコードを実行していたXACTエラー: https://github.com/HazyResearch/cs145-notebooks-2016/issues/4

+0

フィルタの周りにリスト()を追加しようとしています – Avery246813579

+0

どの行ですか? OpBase .__ init __(self、op1.schema + filter(lambda x:xはself.common、op2.schemaにはない)、[op1、op2])? –

+0

@ Avery246813579はあなたの問題を解決する 'list(filter(...))'を提案しています –

答えて

0

次の行に変化することを確認:に

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

を:

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

は、問題を修正しました。