from multiprocessing import Poolclass A: def __init__(self, n): self.n = n def __foo(self, i): return i + 1 def bar(self): l = list(map(self.__foo, range(self.n))) print(len(l)) def baz(self): pool = Pool(2) l = list(pool.map(self.__foo, range(self.n))) print(len(l))a = A(3)a.bar()a.baz()这是简短的输出:3AttributeError: 'A' object has no attribute '__foo'我想用它Pool来处理一个大的dataframe,但Pool.map不起作用——如何处理它?
添加回答
举报
0/150
提交
取消