Skip to content

What are Blocks?

Reports are comprised of multiple Blocks, which wrap up Python objects, such as Pandas DataFrames, Visualisations, and Markdown. Datapane also includes layout blocks to add tabs, pages, and interactive selects to your reports.

We are always adding new blocks, and if you have some ideas on what you would like to use in your reports, please start a discussion on the Datapane forum.

In this section we've grouped Blocks into Block types. Learn how to use them from our blocks catalogue, and more detailed API usage can be found in our API docs.

Block types

Nesting of Blocks

Except for Page blocks, every block can be nested inside a layout block, meaning you can build arbitrarily complex reports. In addition, most blocks take optional name and caption parameters and display those to your viewers.

Default Block Handling

As well as explicitly specifying your block type (for instance, by using dp.Plot), Datapane will try and choose the best block for your object if you pass it in directly, for instance as follows:

import datapane as dp
import pandas as pd

d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)

report = dp.Report(
  "This is text"

The defaults are as follows:

Object Type Datapane Block
pandas DataFrame dp.Table
string dp.Text
Altair dp.Plot
Bokeh dp.Plot
Folium dp.Plot
Matplotlib / Seaborn dp.Plot
Plotapi dp.Plot
Plotly dp.Plot