Configure a list column in st.dataframe or st.data_editor.

This is the default column type for list-like values. List columns are not editable at the moment. This command needs to be used in the column_config parameter of st.dataframe or st.data_editor.

Function signature[source]

st.column_config.ListColumn(label=None, *, width=None, help=None)

Parameters

label (str or None)

The label shown at the top of the column. If None (default), the column name is used.

width ("small", "medium", "large", or None)

The display width of the column. Can be one of "small", "medium", or "large". If None (default), the column will be sized to fit the cell contents.

help (str or None)

An optional tooltip that gets displayed when hovering over the column label.

Examples

import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
    {
        "sales": [
            [0, 4, 26, 80, 100, 40],
            [80, 20, 80, 35, 40, 100],
            [10, 20, 80, 80, 70, 0],
            [10, 100, 20, 100, 30, 100],
        ],
    }
)

st.data_editor(
    data_df,
    column_config={
        "sales": st.column_config.ListColumn(
            "Sales (last 6 months)",
            help="The sales volume in the last 6 months",
            width="medium",
        ),
    },
    hide_index=True,
)
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.