How can I perform rolling operations without a fixed window size?
You can accomplish this with an update
or an update_view
and two update_by
operations. Say, for instance, you have a source
table with two columns: Value
and Sym
. You want to calculate the running sum of Value
, but have that sum reset every time DesiredValue
occurs in Sym
. A solution would look something like this:
result = source.update_view(["Counter = Sym == `DesiredValue`"]).update_by(
ops=cum_sum(["SumValue = Value"], by=["Counter"])
)
note
These FAQ pages contain answers to questions about Deephaven Community Core that our users have asked in our Community Slack. If you have a question that is not in our documentation, join our Community and we'll be happy to help!