Skip to content

st.column_config.MultiselectColumn values are not saved when"data" is empty in data_editor #12842

@hedihargambayer

Description

@hedihargambayer

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

Streamlit version: 1.50.0
Python version: 3.11

Hello, I was trying to use the new st.column_config.MultiselectColumn component. However when you try to use it with with an empty dataframe (only columns names) for the “data’ parameter in the st.data_editor function it looks like the selected values for the multiselect are not saved.

Reproducible Code Example

Open in Streamlit Cloud

import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
    columns=[
        "category", "test"
    ]
)
edited_data = st.data_editor(
    data_df,
    num_rows="dynamic",
    column_config={
        "test": st.column_config.TextColumn('test'),
        "category": st.column_config.MultiselectColumn(
            "App Categories",
            help="The categories of the app",
            options=[
                "exploration",
                "visualization",
                "llm",
            ],
        ),
    },
)
st.write(edited_data)

Steps To Reproduce

  1. Edit the "category" column of the dataframe
  2. Observe no change on the printed value of the edited dataframe for the "category" column

Expected Behavior

Expected behavior is to get the selected options saved in the edited_data variable. Like other column type (text, selectbox...)

Current Behavior

Currently, when the data is initially empty on st.data_editor, modifications on MultiselectColumn are not saved

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.50
  • Python version: 3.11
  • Operating System: MacOs
  • Browser: Chrome

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.data_editorRelated to the `st.data_editor` widgetpriority:P2Medium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions