首页 > 解决方案 > python的apply()函数中的运行时错误

问题描述

我正在 Coursera 上学习机器学习课程

当我运行以下命令时

 sf['Country'] = sf['Country'].apply(transform_country)

以下是我得到的错误

RuntimeError                              Traceback (most recent call last)
<ipython-input-10-e97a176c3eea> in <module>()
----> 1 sf['Country'] = sf['Country'].apply(transform_country)

F:\Anaconda2\envs\gl-env\lib\site-packages\graphlab\data_structures\sarray.pyc in apply(self, fn, dtype, skip_undefined, seed)
   1892 
   1893         with cython_context():
-> 1894             return SArray(_proxy=self.__proxy__.transform(fn, dtype, skip_undefined, seed))
   1895 
   1896 

F:\Anaconda2\envs\gl-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. Cannot evaluate lambda. Lambda workers cannot not start.

现在我该怎么做 ?

标签: pythonpython-3.xpandasruntime-error

解决方案


推荐阅读