I prefer to use Panel for my data apps. Here is why.

Marc Skov Madsen
13 min readFeb 19, 2022

--

I am Marc Skov Madsen. I have a passion for interactive data analysis and data apps. And a lot of experience across frameworks.

So people often ask me: What do you use? Or why do you prefer XYZ over ABC?

Example tweet that started discussion about which data app framework I prefer and why

So I figured, why not write about data apps and why I prefer to use Panel to develop them. Here goes.

Summary

In essence I prefer Panel because I, my team and my users can start out building data apps as easily as with Streamlit. But its much, much more flexible and extensible than Streamlit and Dash.

Panel works for developers of all skill levels and preferences.

Panel integrates with many more of Pythons powerful data ecosystems than Streamlit and Dash. Including Jupyter, ipywidgets and HoloViz.

Data Apps

Data apps are a category of apps specifically geared towards helping teams easily manage or communicate data and model based operations. They are most often developed by you or your colleague 👩‍💼.

Example signal processing app using Panel
Panel data app used to understand price-volume relations using Scipy and HoloViews

The worlds most used data app framework is Microsoft Excel. Tableau and other BI tools are very popular but rather limited data app frameworks. R has Shiny. In Python the most used frameworks are Bokeh, Plotly Dash, Panel, Streamlit and Jupyter Voila with ipywidgets.

I truly believe it is a super power for you and your team to master a R or Python based data app framework if you work as an analyst, scientist, engineer, data engineer, data scientist or similar.

If you master a R or Python based data app framework you can explore larger datasets and models, automate repetitive tasks, work independently of hard to get frontend development teams, communicate your work, iterate on products with others quickly and ship new products often.

Panel data app using scikit-image to work with image edges and color maps

Panel

Panel is a high level app and dashboarding framework for Python that works with the tools you know and love ❤️. Panel has +2200 ⭐ on Github and +700.000 package downloads per month (Source: pyviz.org).

Panel data app using Datashader and HoloViews to provide big data viz with cross filtering

I am a Python based data scientist and prefer Panel because I believe it is the most Pythonic, flexible and powerful data app framework out there. I will try to show you what I mean.

A basic Panel data app

A basic Panel data app can look like

Panel “Getting Started Example App”

The code for this app looks like

When you have run pip install requirements.txt, you can serve the app by running panel serve panel_getting_started.py.

The app is then available in your browser at http://localhost:5006/getting_started.

You can learn how to create Panel apps via the Getting Started Guide.

If you just want to sit back and get inspired, check out my Introduction to Panel video from PyData Global 2021.

Introduction to Panel from PyData Global 2021

I can explore and develop efficiently using VS Code

Personally I prefer working in .py files in VS Code using a lot of extensions to speed up my workflow. I rely on isort, black, pylint, mypy and pytest to ensure a high code quality.

Panels --autoreload flag enables me to get a very fast feedback on code changes.

To speed up the auto reload and my apps in general, I sometimes use the awesome Python package diskcache .

Panel App using DiskCache

You can find the caching example app here.

Panel also supports interactive data exploration in the Jupyter Extension.

Panel component working in the Interactive View

My colleagues can explore and develop efficiently using the environment they know and love

Most of my colleagues do not work in VS Code. Instead they work in Jupyter Notebooks, Jupyter Labs, Jupyter Hub, Spyder and PyCharm.

Panel works great in all these environments. Streamlit does not work in a Notebook environment. Dash provides a limited interactive experience (embedding) in a notebook environment.

You can try out the notebook experience by running the Panel Getting Started Notebook Example on Binder or in Colab.

If you work in Jupyter lab you should definitely install the Jupyter Preview via jupyter serverextension enable panel.io.jupyter_server_extension to speed up your workflow.

Using Panel in Jupyter Labs with the Jupyter Preview enabled

We can use Panel for interactive data exploration

As you have seen above we can use the same code for interactive data exploration in notebooks and IDEs as we use for data apps. This is quite powerful, avoids duplication of work and enables moving easily from exploration to production and back.

Dash and Streamlit are primarily useful for building data apps.

We can build highly performant and snappy data apps with Panel

Dash, Panel and Streamlit have very different architectures and build on different technologies. This matters for performance.

For example only Panel can deliver the performance needed to continuously explore your data or model. Streamlit does not support updating the UI when dragging the slider because their UI cannot not update fast enough. Dash does, but quickly gives up.

Data app performance comparison. Only Panel can support updating a plot when a slider is dragged

You can find the details here.

We can create multi page apps quickly with Panel

In my working environment short time to market is key. Panel supports adding new apps quickly by just serving more .py or .ipynb files.

Panel multi-page app

Notice how you even get a nice Gallery page for free.

Streamlit has no built in support for multipage apps. Dash supports multi page apps, but its does not have the simplicity of just serving multiple files.

We can use the plotting library our customers know and love

In my team we’ve settled on HighCharts as our go to plotting library for data apps because we support traders. HighCharts is the plotting library the traders know and love from other (commercial) applications and from a lot of web sites.

To support this use case I’ve developed the PANEL-HIGHCHARTS extension.

Please note you will need a HighCharts license for commercial use.

Building a HighCharts extension with the same powerful two-way communication is currently not possible in Streamlit. I actually believe it never will be due to Streamlits “run script top to bottom” architecture.

You can use the plotting libraries you know and love

Panel supports a wide and growing range of plotting libraries. This makes it so much easier to collaborate, support many use cases and avoid “dead ends”.

Pane data app using Altair, Bokeh, DeckGl, Echarts, Folium, Matplotlib, Plotly, Plotnine, PyDeck, PyEcharts, PyVista, Seaborn, Vega and VTK

You can try out the app above and explore the code here.

Panel has built in two-way communication (mouse click, hover etc.) for Bokeh, DeckGl, Plotly, PyVista, VTK and from Panel 0.13 Altair/ Vega.

Streamlit supports almost the same list of plotting libraries, but has no built in two-way communication.

Dash supports several plotting libraries, but the main focus is on their own plotting library Plotly. Plotly is a really great plotting library, but it does not work for all users and use cases.

We can use very powerful tables

In my context of finance and trading advanced tables are key. Panel has built in support for powerful tables via the DataFrame widget, DataFrame pane and the Tabulator pane.

Tabulator supports key operations like formatting, styling, filtering, editing, selecting, clicking, patching, streaming, theming, freezing rows and columns, grouping, pagination and much more.

Panel data app with Tabulator formatting, streaming and different themes

Tabulator can even be extended to support sparklines.

Panel data app with Tabulator and sparklines

If you want to learn more about Tabulator check out the reference guide or play with it in a live notebook on Binder.

The Streamlit st.dataframeand the Dash datatableare not nearly as powerful. There are extensions that try to provide better tables. But they don’t appear similarly powerful or popular. I actually believe that Streamlit architecture of “run script top to bottom” will make it difficult to support fast updating applications reacting to editing, selection, hover etc. events.

We can provide pivot tables to our users

In my context of finance and trading people love their pivot tables. Panel has built in support for the powerful Finos Perspective pivot table developed at JP Morgan.

The Panel Perspective pane in action

Streamlit has no support for pivot tables. Dash has the powerful PivotTableJS extension.

We can tap into the extensive Ipywidgets ecosystem

To be honest this is a truth with modifications, not all ipywidgets work with Panel today. But Panel supports two-way communication with ipywidgets in general via the jupyter_bokeh package. So your favorite ipywidgets might be supported today or some day in the future.

Panel data app using ipyleaflet

You can find the code of the ipyleaflet data app here.

Neither Streamlit nor Dash supports ipywidgets with bidirectional communication.

Ipywidgets does not work with Dash

The ambition to integrate with Jupyter and Ipywidgets is very important for me. Jupyter and Ipywidgets is the starting point for interactive data exploration in Python. This is where a lot of data driven innovation begins. I dream that one day the Bokeh/ Panel/ Jupyter/ Ipywidgets integration will pick up more interest and find some funding.

We can tap into the ambitious and innovative HoloViz ecosystem

Panel is member of the ambitious HoloViz ecosystem that aims to provide high-level tools to simplify visualization in Python.

The HoloViz ecosystem

Panel provides first class support for all of these tools.

We have first class support for interactive big data visualization via Datashader

I believe we will have to interactively visualize bigger and bigger datasets. Like in millions and billions of rows. Datashader enables this. Panel has first class support for this via Datashader as they are both members of the HoloViz ecosystem.

An example use case is cuxfilter from RapidsAI/ Nvidia. Its a framework to connect web visualizations to GPU accelerated crossfiltering built on top of Panel and Datashader.

I’m also quite inspired by how GluonNet has used Panel and Datashader to develop an application based on aviation data to find and prevent illegal activities.

Dash has some support for Datashader via integrations with HoloViews. But looking in its community forum it does not seem supported or even working.

Streamlit does not support Datashader. I actually believe the “run script top to bottom” architecture of Streamlit will make it hard to support Datashader.

We have first class support for easy, interactive plotting of dataframes via hvplot

Hvplot is a drop in replacement for the well known Pandas .plot api. Hvplot creates interactive Holoviews objects. These objects are very flexible and powerful.

Panel data app using hvplot
Basic code example of using hvplot with Panel

Note how I’ve just

  • replaced .plot with .hvplot.
  • overlayed and layed out objects with simple * and + operators.

You can use hvplot with pandas, dask and xarray dataframes.

As something truly innovative, unique and very powerful Panels widgets can be used with hvplots .interactive to make your dataframe pipelines interactive! Works with Pandas, Dask and XArray dataframes. To be honest this is a new thing (2021) and needs your use and feedback to mature.

Panel data app using hvplot .interactive to make DataFrame pipelines interactive

You should check out the code here. Because you’re worth it😊

Streamlit does not work with hvplot. Dash supports hvplot via its HoloViews integration which seems not to be widely used or supported.

We have first class support for easy to use crossfiltering using HoloViews

Some years ago I was a frequent Tableau user and the feature I enjoyed the most was easy to use crossfiltering. It really enables you to quickly explore and understand your data.

HoloViews provides easy to use crossfiltering and Panel has first class support for HoloViews 🥂.

For more inspiration check out Philipp Rudigers talk “Scalable cross filtering dashboards|PyData Global 2020”.

Scalable cross filtering dashboards from PyData Global 2020

I’ve never seen any apps in Streamlit use crossfiltering. I actually believe the “run script top to bottom” architecture of Streamlit will make this difficult to support.

Dash has developed integrations to HoloViews and its crossfiltering. I feel its a bit convoluted though and the main proponent of the HoloViews integration at Plotly has left the company. So I believe it will never be widely used or supported.

HoloViz provides lots of other powerful tools and apis. For example annotation tools and streaming apis. You can use Bokeh (default), Matplotlib and Plotly as plotting back ends.

We can use Panel to build components and tools for Notebook Users

Our team has to provide a lot of data, models and analytics to our analysts and traders. It is really useful for us that the same interactive component that is available in our data apps also can be used for interactive data exploration in the Notebook.

This makes it easy to support new use cases and provides much of the flexibility and power known from Excel.

In fact Panel could also be used to build powerful tools with bidirectional communication for the notebook. Think Tensorboard, Dask Dashboard, etc. Hope to see that one day.

We can use the most powerful data app templates in the world

Panel provides several data app templates based on the Bootstrap, Material and Fast design system which makes it very easy to create good looking new applications.

The traders I work for have lots of information on their screens and they expect to be able to drag components around. Panel supports this via the grid and golden templates.

Check out my deep dive on theFastGridTemplate . Probably the most powerful datascience app template in the world! 🍺

Streamlit provides a single, built in template. It’s easy to use, looks great, but it does not support basic things like for example a header. Dash provides templates if you buy the enterprise version.

We can design our own custom templates

We can in fact easily develop our own custom template, which we have done for our fundamental model that forecasts power prices. It needed custom branding, a custom header and some specialized navigation.

You cannot design your own custom template with Streamlit. With Dash non-enterprise you actually have to design your own templates.

Our users can share links with the state of the app

We want our users to be able to share links that open the application in the exact same state as where it was when the link was copied. This makes collaboration much easier.

That is easy to do with panel.state.location

Streamlit does not provide this functionality. Dash does.

We can serve static assets

Being able to serve static assets like images simplifies things as we are not dependent on some remote team to provide us with the needed resources and integrations.

Streamlit does not provide this. Dash does via Flask.

We can add powerful REST APIs

Adding a REST API enables us to provide data and models to our end users. It also enables our end users to develop their own interface to our application.

Panel with the tranquilizer REST Api provider

You can find the code here. To learn more check out the REST API introduction its quite innovative what you can do! I hope to see a FastAPI REST provider added one day 💪.

Streamlit does not provide this. Dash provides this via Flask.

There is lots more

I hope to update this article with examples of streaming, async apps and lots more as I get the time to add it.

We can hope for lots of improvements in the future

Panel only has tiny resources compared to Dash and especially Streamlit. The community is also a lot smaller. That combined with a very ambitious vision for HoloViz means that docs, examples, design, code, support does not have the same maturity as those of Streamlit and Dash. The consequence is that can be difficult to get started and tap into all that flexibility and power.

I hope that one day Panel will provide improved docs and an easy deployment option to enable our community to develop and share their data apps much more easily.

If you share the vision, I hope you will one day start contributing to our community, examples, docs, blogs or code. That would make a big difference.

Thanks for taking the time

Feel free to send friendly comments and suggestions to the article my way. You can find my contact details at datamodelsanalytics.com.

For questions on getting started and using Panel please post in the community forum.

You can find additional inspiration at my site awesome-panel.org. I also run awesome-streamlit.org.

You can find me posting about data apps on Twitter (@MarcSkovMadsen) and LinkedIn (@marcskovmadsen), developing examples and extensions on Github (@Marc Skov Madsen) and sharing videos on Youtube (@MarcSkovMadsen).

Best wishes

Marc Skov Madsen, PhD, CFA®

--

--