2017-09-21 1 views
-1

어떻게이 오류를 해결할 수 있습니까? 나는 저자가 내가 이것을 실행하면 https://github.com/HazyResearch/cs145-notebooks-2016/tree/master/lecture-16 같이 Python2.7하지 Python3.6를 사용하는 제안 만들기 때문에 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 notebook의 셀 위의 오류가 발생합니다. 그 전에 다른 셀에 다른 오류가 발생하지 않았습니다. enter image description here

나는 나뿐만 아니라 파이썬 3.6의 코드를 실행중인 XACT 오류 : https://github.com/HazyResearch/cs145-notebooks-2016/issues/4

+0

필터 주위에 list()를 추가하려고 시도 했습니까 – 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]) 

이 문제를 해결합니다.

관련 문제