Nested columns with DataFrame in Streamlit data_editor?

57 Views Asked by At

Looking to implement nested columns in a Streamlit data_editor like the attached image. Any tips or pointers?

I attempted to create nested columns within the dataframe but the cells are not editable(data_editor).

Also, I want to know if I can create complex tables using the data_editor.

Code:

  • Python 3.12.2

  • Streamlit, version 1.32.2

import streamlit as st
import pandas as pd

data = { 
    'col1': {
        'row 1':[1,2,3],
        'row 2':[1,2,3],
        'row 3':[1,2,3]
        },
    'col2': {
        'row 1':[1,2,3],
        'row 2':[1,2,3],
        'row 3':[1,2,3]
        }
    }
df = pd.DataFrame(data)
st.data_editor(df, num_rows='dynamic')
0

There are 0 best solutions below