Skip to main content

PandasRowSelectionInput

Pandas DataFrame row selection input widget for selecting rows from tabular data.

Examples

Basic Usage

This example runs a form with a single page containing the widget

Example Code

import pandas as pd

from abstra.forms import PandasRowSelectionInput, run

data = [
{"Country": "USA", "Population": "32,700,000"},
{"Country": "China", "Population": "1,300,000,000"},
{"Country": "Japan", "Population": "126,000,000"},
]
df = pd.DataFrame(data)

# Create a page with the widget
example_page = [
PandasRowSelectionInput(df=df, key="my-selection", label="Select country")
]

# Run the form
result = run([example_page])

# Print the result
print(result)

Parameters

NameDescriptionTypeDefault
df (required)The pandas DataFrame to display.pd.DataFrameNone
keyIdentifier for the widget.strNone
requiredWhether row selection is required before proceeding.boolTrue
hintHelp text displayed below the input.strNone
full_widthWhether the table should take up the full width of its container.boolTrue
display_indexWhether to display row indices.boolFalse
disabledWhether the input is non-interactive.boolFalse
labelText label displayed above the table.str''
filterableWhether the table is filterable.boolFalse
multipleWhether multiple rows can be selected.boolFalse
initial_valueInitial selected row(s).Union[List, Any]None
minMinimum number of rows that must be selected when multiple=True.intNone
maxMaximum number of rows that can be selected when multiple=True.intNone
page_sizeNumber of rows to display per page.int10
errorsPre-defined validation error messages to display.Union[List[str], str]None
pagination_always_visibleWhether pagination controls are always visible.boolTrue