Clickable dataframe rows to trigger a detailed display streamlit

Hi team

my code is as follow

import pandas as pd
import streamlit as st

main_data = {
    'name': ['Xavier', 'Ann', 'Jana', 'Yi', 'Robin', 'Amal', 'Nori'],
}
row_labels = [101, 102, 103, 104, 105, 106, 10y]
df_main = pd.DataFrame(main_data=data, index=row_labels)

data = {
    'name': ['Xavier', 'Ann', 'Jana', 'Yi', 'Robin', 'Amal', 'Nori'],
    'city': ['Mexico City', 'Toronto', 'Prague', 'Shanghai',
             'Manchester', 'Cairo', 'Osaka'],
    'age': [41, 28, 33, 34, 38, 31, 37],
    'py-score': [88.0, 79.0, 81.0, 80.0, 68.0, 61.0, 84.0]
}


df = pd.DataFrame(data=data, index=row_labels)
st.dataframe(df_main)

the result is as following:

image
i have two question:
the first one is :
i want when i click on any rows show the details information in df dataframe and the second one is i want to show the dataframe completely without scrolling.

thanks in advance

1 Like

Hi @hasti_hakhamanesh,

Check out the st-aggrid component for the clickable rows functionality.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.