How do I dynamically update a pandas DataFrame from a Deephaven table?
I have a pandas DataFrame that I want to update automatically when my Deephaven table updates. How can I write a query that does this?There are two basic ways to do this. The first uses a table listener, which calls a function each time the table updates. The second uses threading to update the DataFrame at regular intervals.
With a table listener
The listener approach uses snapshot_when to capture the table's state at regular intervals, and a table listener to convert the snapshot to a pandas DataFrame each time it updates. This is the recommended approach because it avoids managing a dedicated polling thread.
With Python threading
The threading approach polls to_pandas on a fixed interval. It requires managing the thread's lifecycle.
Related documentation
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!