Skip to main content

Streamlitの標準st.dataframeを拡張した高機能カスタムコンポーネント

Project description

streamlit-advanced-dataframe

Streamlit's st.dataframe with advanced features using TanStack Table.

Installation

pip install streamlit-advanced-dataframe

Usage

import pandas as pd
from streamlit_advanced_dataframe import advanced_dataframe

df = pd.DataFrame({
    "name": ["Alice", "Bob", "Charlie"],
    "age": [25, 30, 35],
    "city": ["Tokyo", "Osaka", "Kyoto"]
})

# Basic usage
advanced_dataframe(data=df, height=400, key="my_table")

# Single row selection
selected = advanced_dataframe(
    data=df,
    selection_mode="single-row",
    key="selectable_table"
)
if selected:
    st.write(f"Selected rows: {selected}")  # Returns list[int]

# Multi-row selection
selected = advanced_dataframe(
    data=df,
    selection_mode="multi-row",
    key="multi_selectable_table"
)
if selected:
    st.dataframe(df.iloc[selected])  # Show selected rows

# Filter columns
advanced_dataframe(
    data=df,
    filterable_columns=["name", "age", "city"],
    show_row_count=True,
    key="filterable_table"
)

# Header groups
advanced_dataframe(
    data=df,
    header_groups=[
        {"header": "Personal Info", "columns": ["name", "age"]},
        {"header": "Location", "columns": ["city"]}
    ],
    key="grouped_table"
)

# Column config (prefix/suffix)
df_sales = pd.DataFrame({
    "product": ["Product A", "Product B"],
    "price": [1000, 2000],
    "discount": [10, 20]
})
advanced_dataframe(
    data=df_sales,
    column_config={
        "price": {"prefix": "$"},
        "discount": {"suffix": "%"}
    },
    key="config_table"
)

Parameters

Parameter Type Default Description
data pd.DataFrame required DataFrame to display
height int 600 Table height in pixels
use_container_width bool False Use full container width
selection_mode "single-row" | "multi-row" | None None Row selection mode
filterable_columns list[str] | None None Columns to enable filtering
show_row_count bool False Show filtered row count
column_order list[str] | None None Columns to display (in order)
header_groups list[dict] | None None Header group configuration
expandable bool False Enable row expansion
sub_rows_key str "subRows" Key for sub-row data
show_summary bool True Show summary row
column_config dict[str, dict] | None None Per-column display config (prefix/suffix)
key str | None None Streamlit component key

Returns

list[int] - List of selected row indices (0-based). Returns an empty list [] when no rows are selected or selection_mode is None.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_advanced_dataframe-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_advanced_dataframe-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_advanced_dataframe-0.1.0.tar.gz.

File metadata

File hashes

Hashes for streamlit_advanced_dataframe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6941da152d3796be2a1db9ff83c20b8d8041780c96319e31f8bfc07734e259dc
MD5 9d86b9184b366c935ae981953d88bac3
BLAKE2b-256 b15e6d6d11ed2784e9ccf8efcbe51ce048340595598cb532bd62702dee6d0894

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_advanced_dataframe-0.1.0.tar.gz:

Publisher: publish-pypi.yml on j4rviscmd/streamlit-advanced-dataframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file streamlit_advanced_dataframe-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_advanced_dataframe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 165bcc6e272ca8a154a55675ada297b0681e03f9185d2738bcfdf10b661cf04e
MD5 6406d8856906f3a746ecbac32ffb1bd4
BLAKE2b-256 ee2b22b07840177249b854f5b9f00c1d376945850084acb0881a433a61d6b0e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_advanced_dataframe-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on j4rviscmd/streamlit-advanced-dataframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page