{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import panel as pn\n", "\n", "pn.extension('perspective', template='fast', sizing_mode='stretch_width')\n", "df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD')).cumsum()\n", "\n", "rollover = pn.widgets.IntInput(name='Rollover', value=15)\n", "\n", "perspective = pn.pane.Perspective(df, height=400)\n", "\n", "def stream():\n", " data = df.iloc[-1] + np.random.randn(4)\n", " perspective.stream(data, rollover=rollover.value)\n", "\\\n", "cb = pn.state.add_periodic_callback(stream, 50)\n", "\n", "pn.Column(\n", " pn.Row(cb.param.period, rollover, perspective.param.theme),\n", " perspective\n", ").servable()" ] } ], "metadata": { "kernelspec": { "display_name": "portfolio_risk_assesment", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11.4" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }