Grid Card
Card type:
agGrid
Data type of variable:
DataFrame

The grid card displays a DataFrame in an interactive, editable grid format. It supports sorting, filtering, and editing of the data. Editing the data will update the DataFrame stored in the connected DataCards variable.
In addition to the common parameters and the input card parameters, the agGrid card has the following configuration options:
Name | Type | Required | Description |
---|---|---|---|
col_defs | list | No | Column definitions that specify how each column should be displayed and behave. See ag-grid documentation  for more details. |
Examples
Basic grid card
import polars as pl
from datetime import datetime
# Create a DataFrame
df = pl.DataFrame({
"date": [
datetime(2024, 1, 1, 8, 30),
datetime(2024, 1, 2, 9, 15),
datetime(2024, 1, 3, 7, 45),
],
"city": ["London", "Paris", "Berlin"],
"temperature_c": [13.3, 12.3, 4.2],
"air_quality_index": [67, 54, 43],
"is_raining": [False, False, True]
})
# Publish the DataFrame
datacards.publish.variable("my_grid_data", df)
# Define column display options
col_defs = [
{
"field": "date",
"headerName": "Date"
},
{
"field": "city",
"headerName": "City"
},
{
"field": "temperature_c",
"headerName": "Temp (°C)"
},
{
"field": "air_quality_index",
"headerName": "Air Quality Index"
},
{
"field": "is_raining",
"headerName": "Raining"
}
]
# Publish the grid card
datacards.publish.card(
type='agGrid',
label='Weather Data',
variable_key='my_grid_data',
col_defs=col_defs,
logic_view_size=(11, 5)
)

Last updated on