Dataframe is not sorted when column title is clicked

According to the documentation a dataframe is supposed to be sorted when the title is clicked. However when I used st.dataframe(df) the table seems static. I am using chrome in a desktop and latest streamlit.

By default, the st.dataframe() function in Streamlit does not provide an option to sort the DataFrame when the title is clicked. Instead, it displays the DataFrame as a static table.

To enable sorting in the table, you can use the st.table() function instead. The st.table() function provides a built-in feature to sort the table when the column headers are clicked. Here is an example:

data = {'name': ['John', 'Alice', 'Bob'], 'age': [25, 30, 35]}
df = pd.DataFrame(data)

st.table(df)

The previous answer is not true at all.

@Hanan_Shteingart
You are right, the documentation says this:
https://docs.streamlit.io/library/api-reference/data/st.dataframe#interactivity

And if i test this with this simple example, it worked:

import streamlit as st
import pandas as pd

st.title('Dataframe Test')
df = pd.util.testing.makeMixedDataFrame()
st.text(df.dtypes)
st.dataframe(df)

Which streamlit version are you using?

Looks like someone is having too much fun with ChatGPT :skull_and_crossbones:

I immediately had the same suspicion. A new user in the forum who registers and immediately begins to answer several questions. Partially even wrong answers. Would a normal user probably rather not do. :face_with_diagonal_mouth:

Column sorting is activated as default for all columns in st.dataframe. But make sure that you are using a recent Streamlit version and not have legacy serialization activated. Column sorting also gets deactivated for large tables (>150k rows). The reason is that sorting at this size significantly impacts the performance since everything happens in-browser.