Skip to content

Using op.lag on same column #402

@MagnusHBrunbjerg

Description

@MagnusHBrunbjerg

Maybe I am misunderstanding the usecase for the op.lag window function, or window functions in general, but I would like to perform a computation on my table that referenced the current row in a different column and the previous row in the same column.

Essentially I would want to perform a calculation similar to the one I have tried to visualize in the table below. Note that this example is simplified to show the concept of what I am trying to achieve but the actual calculations involve multiple row look-back and not only addition.

index a b
0 ... ...
1 ... () => a[1] + b[0]

I assumed I could do that with the lag window function like this:

table.derive({ b: d => d.a + op.lag(d.b) })

But it seems like window functions aren't able to use the calculations made for other rows.

How would I approach this problem using arquero, if it is possible at all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions