Building Reports
All the blocks you can use to develop and layout your reports

Overview

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 components, and if you have some ideas on what you would like to use in your reports, please start a discussion on GitHub.
In this section we describe the Block types and provide examples. More detailed API usage can be found in our API docs.
If you pass your Python object into your without wrapping it in a specific block component, Datapane will try and automatically choose the best block type.

Report Widths

Datapane has three standard report, which dictate sizing and layout:
    Medium: medium width and margins, optimized for mixed content
    Narrow: small width and large margins, optimized for long-form text
    Full: full-width with no margins, optimized for grid layout and visualizations
The default type is Medium, and you can choose other widths when you create your report as follows:
1
import datapane as dp
2
3
# Create a report (default)
4
report.upload(..., formatting=dp.ReportFormatting(width=dp.ReportWidth.MEDIUM))
5
6
# Create a dashboard
7
report.upload(..., formatting=dp.ReportFormatting(width=dp.ReportWidth.FULL))
8
9
# Create an article
10
report.upload(..., formatting=dp.ReportFormatting(width=dp.ReportWidth.NARROW))
Copied!

Block Types

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:
1
import datapane as dp
2
import pandas as pd
3
4
d = {'col1': [1, 2], 'col2': [3, 4]}
5
df = pd.DataFrame(data=d)
6
7
dp.Report(
8
df,
9
"This is text"
10
)
Copied!
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
Plotly
dp.Plot
Last modified 2mo ago