Interactive data grid, pivot table and charts for large, real-time and streaming datasets, with a Jupyter widget and WebSocket server.
Actively maintained. Last release 9 days ago, commits in 23 of the last 26 weeks. A safe choice.
$
pip install perspective-pythonREADME as published on PyPI with version 5.10.0.
perspective-python
Perspective is an open-source data grid, pivot table and charting component for large, real-time and streaming datasets.
perspective-python is the Python distribution of Perspective:
- A streaming query engine —
TableandView— with incremental pivots, aggregates, filters, expressions and joins, reading and writing Apache Arrow, CSV, JSON,pandas,polarsandpyarrow. Tables can be memory-mapped from disk withpage_to_disk=Trueto exceed available memory. PerspectiveWidget, an interactive data grid, pivot table and charting widget for JupyterLab, Jupyter Notebook, VS Code notebooks, Google Colab and marimo, built on anywidget.- WebSocket handlers for Tornado, Starlette (FastAPI) and aiohttp, which serve
real-time dashboards to
<perspective-viewer>in the browser. - Virtual servers which run the same UI directly against DuckDB, ClickHouse, PostgreSQL and Polars, with no data copy.
Installation
pip install perspective-python
For notebooks, install the jupyter extra:
pip install "perspective-python[jupyter]"
An interactive pivot table in Jupyter
import pandas as pd
from perspective.widget import PerspectiveWidget
df = pd.read_csv("superstore.csv")
PerspectiveWidget(df, plugin="Y Bar", group_by=["Region"], columns=["Sales"])
A streaming Table
import perspective
server = perspective.Server()
client = server.new_local_client()
table = client.table({"symbol": "string", "price": "float"}, name="prices")
table.update([{"symbol": "AAPL", "price": 189.5}])
A real-time dashboard server
import tornado.ioloop
import tornado.web
from perspective.handlers.tornado import PerspectiveTornadoHandler
app = tornado.web.Application([
(r"/websocket", PerspectiveTornadoHandler, {"perspective_server": server}),
])
app.listen(8888)
tornado.ioloop.IOLoop.current().start()