相关疑难解决方法(0)

Python:如何在Python中运行嵌套并行进程?

我有一个df交易者交易数据集。我有 2 个级别的 for 循环,如下所示:

smartTrader =[]

for asset in range(len(Assets)):
    df = df[df['Assets'] == asset]
    # I have some more calculations here
    for trader in range(len(df['TraderID'])):
        # I have some calculations here, If trader is successful, I add his ID  
        # to the list as follows
        smartTrader.append(df['TraderID'][trader])

    # some more calculations here which are related to the first for loop.
Run Code Online (Sandbox Code Playgroud)

我想并行化 中每个资产的计算Assets,并且我还想并行化每个资产的每个交易者的计算。完成所有这些计算后,我想根据smartTrader.

这是我第一次尝试并行处理,所以请耐心等待,非常感谢您的帮助。

python parallel-processing python-multiprocessing

5
推荐指数
1
解决办法
5843
查看次数