Tables, Data and Big Numbers
Datapane has various blocks for adding datasets to your reports, from simple tables to interactive drilldowns.

Table

The Table component takes a pandas DataFrame and renders an HTML table in your report.
1
import datapane as dp
2
import pandas as pd
3
import numpy as np
4
5
df = pd.DataFrame({
6
'A': np.random.normal(-1, 1, 5),
7
'B': np.random.normal(1, 2, 5),
8
})
9
10
table = dp.Table(df)
11
report = dp.Report(table)
12
report.upload(name='sample_table')
Copied!
If your DataFrame includes DataFrame Styles, these will be included in your report. DataFrame styles allows you create custom formatted tables; for instance, to show trends, highlight cells, add bar charts, or display correlations.
Table is the best option for displaying multidimensional DataFrames, as DataTable will flatten your data.

DataTable

The DataTable block takes a pandas DataFrame and renders an interactive, sortable, searchable table in your report, along with advanced analysis options such as exploring data through SandDance. It supports large datasets and viewers can also download the table from the website as a CSV or Excel file.
DataTable works for reports uploaded to Datapane.com as well as locally saved reports.
1
import datapane as dp
2
import pandas as pd
3
import numpy as np
4
5
df = pd.DataFrame({
6
'A': np.random.normal(-1, 1, 5000),
7
'B': np.random.normal(1, 2, 5000),
8
})
9
10
table = dp.DataTable(df)
11
report = dp.Report(table)
12
report.upload(name='sample_table')
Copied!

Running Queries on DataTable

You can run SQL queries on your datatable if you need more advanced filtering & calculations. In the previous example, if we wanted to show only the rows which had a value A > 0.5, we would write the following (note that $tbl is the builtin table name and cannot be changed):
1
SELECT * FROM $tbl
2
WHERE A > 0.5
Copied!

Python Dictionary & JSON

To include Python objects and JSON, we recommend using the File block.

Big Number

A single number or change can often be the most important thing in a report. The BigNumbercomponent allows you to present KPIs, changes, and statistics in a friendly way to your viewers. You can optionally set intent, and pass in numbers or text.
For full reference on styling your number, see the API Documentation.
Python
Text Report
1
import datapane as dp
2
3
dp.Report(
4
dp.Group(columns=2,
5
dp.BigNumber(
6
heading="Number of percentage points",
7
value="84%",
8
change="2%",
9
is_upward_change=True
10
),
11
dp.BigNumber(
12
heading="Simple Statistic",
13
value=100
14
)
15
)
16
).upload(name="sample_bignum")
Copied!
1
```datapane
2
block: Group
3
columns: 2
4
blocks:
5
- block: BigNumber
6
heading: Number of percentage points
7
value: 84%
8
change: 2%
9
is_upward_change: True
10
- block: BigNumber
11
heading: Simple Statistic
12
value: 100
13
```
Copied!
Last modified 23d ago