deephaven / deephaven-docs-community

Source code for Community docs on the deephaven.io website.
Apache License 2.0
0 stars 5 forks source link

Community Question: #168

Closed margaretkennedy closed 4 months ago

margaretkennedy commented 4 months ago

Is it possible to group by timeframe? i,e group incoming streaming data every 5 minutes? something like pandas grouper (https://pandas.pydata.org/docs/reference/api/pandas.Grouper.html)?

Yes! There are built-in methods to do just that. Use lowerBin or upperBin. Here’s an example:

from deephaven import empty_table
t = empty_table(100).update(["Timestamp = '2024-03-04T00:08:00' ET + i * MINUTE", "TimestampBinned = lowerBin(Timestamp, 5 * MINUTE)"])