Display
flatbread.output.html.display.PitaDisplayMixin
Mixin for displaying pandas objects using data-viewer
configure_display(**kwargs)
Configure display options for the flatbread-table web component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locale
|
str | None
|
Locale string for number and date formatting (e.g. 'en-US', 'nl-NL'). |
required |
na_rep
|
str
|
String to display for null values. Default '-'. |
required |
margin_labels
|
set[str]
|
Labels to style as margin rows/columns. |
required |
collapse_columns
|
bool | None
|
Collapse column headers into the index header row. |
required |
max_rows
|
int
|
Maximum rows before truncating. Default 30. |
required |
max_columns
|
int
|
Maximum columns before truncating. Default 30. |
required |
trim_size
|
int
|
Number of head/tail rows to show when truncated. Default 5. |
required |
separator
|
str
|
String shown in separator cells. Default '...'. |
required |
no_wrap
|
bool
|
Prevent text wrapping in cells. |
required |
column_border_levels
|
int | None
|
Number of column group levels that get borders. |
required |
section_levels
|
int | None
|
Number of index levels to convert into section headers. |
required |
hide_group_borders
|
bool
|
Hide vertical borders between column groups. |
required |
hide_row_borders
|
bool
|
Hide horizontal borders between rows. |
required |
hide_thead_border
|
bool
|
Hide border below the header. |
required |
hide_index_border
|
bool
|
Hide border between index and data columns. |
required |
show_hover
|
bool
|
Enable row hover highlighting. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Returns self for method chaining. |
Examples:
>>> df.pita.configure_display(locale='en-US', show_hover=True)
>>> df.pita.configure_display(section_levels=1, hide_row_borders=True)
set_locale(locale)
Set the locale for number/date formatting
set_na_rep(na_rep)
Set null value representation
set_max_rows(max_rows)
Set maximum rows before truncating
set_max_columns(max_columns)
Set maximum columns before truncating
set_trim_size(n)
Set number of items to show when truncated
set_separator(sep)
Set truncation indicator
hide_borders(hide=True)
Hide all borders
show_group_borders(show=True)
Show/hide vertical column borders
show_row_borders(show=True)
Show/hide horizontal row borders
show_header_border(show=True)
Show/hide header bottom border
show_index_border(show=True)
Show/hide index right border
show_hover(show=True)
Enable row hover effect
collapse_columns(collapse=True)
Collapse column headers
set_section_levels(levels)
Set index levels to show as sections
set_margin_labels(*labels)
Set labels to be treated as margins
set_no_wrap(no_wrap=True)
Enable/disable text wrapping in cells
set_column_border_levels(levels)
Set number of column group levels that get borders
format(key, format_spec)
Set format options for a column or index level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Column name or index level name to format. |
required |
format_spec
|
str | dict
|
Either a preset name (e.g. 'currency') or format options dict. |
required |
format_columns(formats)
Set multiple column formats at once
get_format_presets(dtype=None)
Get available format presets, optionally filtered by dtype
data_spec()
Get the raw table specification as a dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary containing: - values: 2D array of cell values - columns: dict with values, names, dtypes, formatOptions - index: dict with values, names, dtypes, formatOptions |
get_json()
Get the table specification as a JSON string.
Returns:
| Type | Description |
|---|---|
str
|
JSON string containing the complete table specification. The JSON is serialized using the same custom serialization logic used for display, handling pandas-specific types like Timestamps and Intervals. |