我正在尝试进行如下所示的多重处理:
from multiprocessing import Pool
def main():
df1 = function1()
df2 = function2(df1)
df3 = list(df2.groupby('key')
p = Pool(2)
p.map(model, df3)
上面的方法很完美。但是,当我添加以下内容时:
from multiprocessing import Pool
def main():
df1 = function1()
df2 = function2(df1)
df3 = list(df2.groupby('key')
df4 = [x+ (df1 [x[0]][0],)+ (df1 [company[0]][1],) for x in df3 ]
p = Pool(2)
p.map(model, df4)
现在我收到此错误:
cPickle.PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
我不明白那多余的线怎么使它失败?没有外部函数调用。