Skip to content


Datapane is built on the really simple concept of Blocks, which are Python-based objects that represent an individual unit that can be processed and viewed. For instance, there are blocks to represent the concept of a Plot, or a BigNumber. What makes Blocks powerful is that they can be composed and combined together really easily to build powerful and impactful that represent a data-driven View.


You can think of blocks as similar to HTML Elements / Tags, but specialized on creating Data-driven UIs and applications


There are three main types of Blocks provided by default in Datapane, these are,

  1. Display Blocks - these are blocks that display data, such as a Plot (dp.Plot) or a DataTable (dp.DataTable). They take Python objects, such as Panda DataFrames, and automatically convert them into a form that can be viewed
  2. Layout Blocks - these are blocks that can be used to layout other Blocks, such as dp.Group that can group blocks together in columns, or dp.Select that allows a user to Select between multiple blocks. They take other Blocks as their input and layout them out as needed to help ou build complex and visually informative layouts.
  3. Compute Blocks - Compute Blocks allow you take input within your UI, and call Python-functions that return blocks dynamic in response - this is used to power Datapane Apps, describe later in these docs.

Tne most exciting thing about Blocks is that they are fully composable, recursive, and can be combined at will - you can create functions that return Blocks, pass them into other Blocks, (i.e. pass a Group of plots laid out as columns into a Select) and more. This makes it easy to build up a library of reusable functions and components that process data and return Blocks to insert into your Views. We have a reusable, open-source set of such Components that you can start working with immediately and easily build your own.


Below is a simple example that demonstrates building up a collection of blocks, including a dp.Text block that supports Markdown, a Plot block, and a DataTable block. The Plot and DataTable are laid out within a Group Block to provide some structure.

import altair as alt
import datapane as dp
from vega_datasets import data

df = data.iris()

fig = (
    .encode(x="petalLength", y="petalWidth", color="species")

dp.View(dp.Text("# My report"), 
        dp.Select(dp.Plot(fig), dp.DataTable(df)))


The blocks in the example above have been combined together to provide a programmatically generated, but static, view of the data - we term this a Data View.


You may never actually work with dp.View directly, Datapane supports lots of shortcuts and helpers to improve ease-of-use and make common patterns easy - for instance you can just return a single Block or a list of Blocks and it will all work as expected.

As you may have noticed in the Quickstart, Blocks and Views can be viewed and previewed automatically within Jupyter, making interactive development trivial.


You can think of a Data View like a fragment of HTML specialised on Data focussed output

Datapane provides may ways to work with these Data Views, including - using them to enhance Jupyter notebooks (as above) - composing and combining them together, - converting them into Datapane Reports that can be saved or uploaded to Datapane Cloud, shared and more - attaching backend processing to them so that they become dynamic as per Datapane Apps, - (coming soon!) generating them on a schedule via your own code or expertly crafted components via Datapane Functions