-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
area:arrowRelated to Arrow data serializationRelated to Arrow data serializationfeature:st.dataframeRelated to the `st.dataframe` elementRelated to the `st.dataframe` elementpriority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expectedupstreamIssue caused by upstream dependencyIssue caused by upstream dependency
Description
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
If indices of a pandas dataframe has pd.Categorical type, st.dataframe seems not showing such indices properly. This behavior occurs for streamlit >= 1.32.0.
Reproducible Code Example
import streamlit as st
import pandas as pd
data = [["a", 1], ["b", 2]]
df = pd.DataFrame(data, columns=["x", "y"])
df["x"] = pd.Categorical(df["x"], categories=["a", "b"])
st.dataframe(df.set_index("x"))Steps To Reproduce
Run streamlit run <filename>.py
Expected Behavior
Column a should display "a" and "b" like the image below.
Current Behavior
Column a shows empty values as follows.
If you double-click the cell, the value is displayed.
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.39.0
- Python version: 3.10.10
- Operating System: Mac OS 15.0
- Browser: Google Chrome
Additional Information
Downgrading to streamlit==1.31.1 removes this bug.
github-actions, adamkgoldfarb, WestedCrean and sfc-gh-lmasuch
Metadata
Metadata
Assignees
Labels
area:arrowRelated to Arrow data serializationRelated to Arrow data serializationfeature:st.dataframeRelated to the `st.dataframe` elementRelated to the `st.dataframe` elementpriority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expectedupstreamIssue caused by upstream dependencyIssue caused by upstream dependency