Tables & Data
Table
¶
Table blocks store the contents of a DataFrame as a HTML table
whose style can be customised using
pandas' Styler
API.
Tip
Table
is the best option for displaying multidimensional DataFrames, as DataTable
will flatten your data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Union[DataFrame, Styler]
|
The pandas |
required |
caption |
Optional[str]
|
A caption to display below the table (optional) |
None
|
name |
BlockId
|
A unique name for the block to reference when adding text or embedding (optional) |
None
|
label |
str
|
A label used when displaying the block (optional) |
None
|
¶
Simple Table from DataFrame¶
Styled Table from DataFrame¶
If your DataFrame includes DataFrame Styles, these will be included in your app. DataFrame styles allow you create custom formatted tables; for instance, to show trends, highlight cells, add bar charts, or display correlations.
DataTable
¶
The DataTable block takes a pandas DataFrame and renders an interactive, sortable, searchable table in your app, 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.
Tip
Table
is the best option for displaying multidimensional DataFrames, as DataTable
will flatten your data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
The pandas dataframe to attach to the report |
required |
caption |
Optional[str]
|
A caption to display below the plot (optional) |
None
|
name |
BlockId
|
A unique name for the block to reference when adding text or embedding (optional) |
None
|
label |
str
|
A label used when displaying the block (optional) |
None
|
¶
Simple DataTable from DataFrame¶
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 $table
is the builtin table name and cannot be changed):
BigNumber
¶
A single number or change can often be the most important thing in an app.
The BigNumber
block 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
heading |
str
|
A title that gives context to the displayed number |
required |
value |
NumberValue
|
The value of the number |
required |
prev_value |
Optional[NumberValue]
|
The previous value to display as comparison (optional) |
None
|
change |
Optional[NumberValue]
|
The amount changed between the value and previous value (optional) |
None
|
is_positive_intent |
Optional[bool]
|
Displays the change on a green background if |
None
|
is_upward_change |
Optional[bool]
|
Whether the change is upward or downward (required when |
None
|
name |
BlockId
|
A unique name for the block to reference when adding text or embedding (optional) |
None
|
label |
str
|
A label used when displaying the block (optional) |
None
|
¶
Simple BigNumber¶
BigNumber with change indicators¶
dp.Group(
dp.BigNumber(
heading="Percentage points",
value="84%",
change="2%",
is_upward_change=True,
),
dp.BigNumber(
heading="Percentage points",
value="84%",
change="2%",
is_upward_change=False,
),
dp.BigNumber(
heading="Points",
value="1234",
change="200",
is_upward_change=True,
),
dp.BigNumber(
heading="Points",
value="1234",
change="200",
is_upward_change=False,
),
columns=2,
)