[Python] Vectorization of path dependent processes

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    I have a set of code that is currently using iterrows in order to calculate values. As an example, I am defining df['old'] in the next row = df['old ']*df['scale'] + df['old'] of the previous row. Then, during the next iterration I am able to use the updated 'old' value to calculate the next row's values. In addition, the formula contains conditional statements involving columns of the previous row, leading to a dynamic formula.

    Since, my data is path dependent, the sequence/values of 'old' are necessary to generating the correct value- hence my necessity to iterate.

    However, I realized that using iterrows is quite a slow processes, so I was wondering if there are ways I can vectorize it, or speed it up, for path dependent data.

    Continue reading...

Compartilhe esta Página