我想使用一個簡單的適用於s幀充滿數據。這是爲了在其中一個列上進行簡單的數據轉換,它應用了一個接受文本輸入並將其分割成列表的函數。這裏是函數和它的調用/輸出:使用sframe.apply()導致運行時錯誤
In [1]: def count_words(txt):
count = Counter()
for word in txt.split():
count[word]+=1
return count
In [2]: products.apply(lambda x: count_words(x['review']))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-8-85338326302c> in <module>()
----> 1 products.apply(lambda x: count_words(x['review']))
C:\Anaconda3\envs\dato-env\lib\site-packages\graphlab\data_structures\sframe.pyc in apply(self, fn, dtype, seed)
2607
2608 with cython_context():
-> 2609 return SArray(_proxy=self.__proxy__.transform(fn, dtype, seed))
2610
2611 def flat_map(self, column_names, fn, column_types='auto', seed=None):
C:\Anaconda3\envs\dato-env\lib\site-packages\graphlab\cython\context.pyc in __exit__(self, exc_type, exc_value, traceback)
47 if not self.show_cython_trace:
48 # To hide cython trace, we re-raise from here
---> 49 raise exc_type(exc_value)
50 else:
51 # To show the full trace, we do nothing and let exception propagate
RuntimeError: Runtime Exception. Unable to evaluate lambdas. Lambda workers did not start.
當我運行我的代碼時,我得到那個錯誤。 s幀(df)只有10乘以2,所以應該沒有來自那裏的過載。我不知道如何解決這個問題。
你不想要'產品['review']。apply(count_words)'? – EdChum
我得到了與Graphlab 2.1相同的運行時錯誤。然後我重新編寫我的代碼塊並執行時沒有錯誤。不知道爲什麼,但對於遇到同樣錯誤的任何人來說,這可能值得嘗試。 – garbo999