pandas multiprocessing apply

后端 未结 8 1423
借酒劲吻你
借酒劲吻你 2020-11-28 06:02

I\'m trying to use multiprocessing with pandas dataframe, that is split the dataframe to 8 parts. apply some function to each part using apply (with each part processed in d

8条回答
  •  囚心锁ツ
    2020-11-28 06:31

    You can use https://github.com/nalepae/pandarallel, as in the following example:

    from pandarallel import pandarallel
    from math import sin
    
    pandarallel.initialize()
    
    def func(x):
        return sin(x**2)
    
    df.parallel_apply(func, axis=1)
    
    

提交回复
热议问题