Skip to content

Support pandas category dtype in dataframe index #6680

@oliverlambson

Description

@oliverlambson

Problem

When displaying an index/multi-index that includes a category datatype, a warning is displayed saying "The value is not part of the allowed options."

I can't find much documentation on this apart from previous closed issues which all seem to say it should work, but this definitely appears to be a Streamlit warning (it even has a "⚠️" next to each cell element)

e.g., st.dataframe(df) where df.index has dtype == "category"

Solutions

My current temporary solution is just to reset the index, but then you lose the Excel-like frozen column scrolling...

i.e., st.dataframe(df.reset_index()) gets rid of the warning at least.

Additional context

May be linked to:
#47, #453, #4927


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.dataframeRelated to the `st.dataframe` elementtype:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions