Need st.dataframe dictionary item value

Dear Sir,
I have included my code along with an image that illustrates its correct operation. However, I wish to set the checkbox value to either true or false. In the code and image provided, the dictionary at the top shows that selected = true. I seek your assistance in retrieving the value of this variable as either true or false. Kindly offer guidance and the appropriate code to achieve this.
how get the selected item value in variable

see my cdoe

import streamlit as st
from streamlit import session_state as ss
import pandas as pd
st.header(“Single Record Selection with Sorting and Export to Excle”)

def mpg_change():
edited_rows: dict = ss.mpg[‘edited_rows’]
st.write(edited_rows)
ss.selected_row_index = next(iter(edited_rows))
ss.df1.loc[ss.df1[‘selected’], ‘selected’] = False
update_dict = {idx: values for idx, values in edited_rows.items()}
ss.df1.update(pd.DataFrame.from_dict(update_dict, orient=‘index’))

if ‘selected_row_index’ not in ss:
ss.selected_row_index = None

@st.cache_data
def get_data(nrows):
url = ‘https://raw.githubusercontent.com/Munees11/Auto-MPG-prediction/master/Scripts/auto_mpg_dataset.csv
return pd.read_csv(url, nrows=nrows)

if ‘df1’ not in ss:
ss.df1 = get_data(10)
ss.df1[‘selected’] = [False] * len(ss.df1)
ss.df1 = ss.df1[[‘cylinders’, ‘car_name’, ‘mpg’, ‘selected’]]

st.markdown(‘### Master Table’)
with st.container(border=True):
edf = st.data_editor(
ss.df1,
num_rows=“dynamic”,
hide_index=True,
on_change=mpg_change,
key=‘mpg’,
use_container_width=True
)

Do you need the full power of the data editor, or are you only using it for row selections? If you are only using it for row selections, you might trying using the feature that’s specifically for that. Here’s a tutorial for dataframe row selections: Get dataframe row-selections from users - Streamlit Docs

If you are doing something else with the data editor besides row selection, here’s an older tutorial that shows how you filter your original dataframe to get your selected rows: Get dataframe row-selections from users (streamlit<1.35.0) - Streamlit Docs

thank you for your pormpt
but boss how to get the status for data_editor that in
ss.mpg[‘edited_rows’]
ss.mpg[‘Add_rows’]
ss.mpg[‘Delete_rows’]
for append and delete the row with seletion the record
when add_row it append data in dataframe

The widget will output the new, edited dataframe. However, if you want to get the edited dataframe from Session State, you’ll have to apply the edits to your original dataframe yourself. (Loop through each of the edits, deletions, and additions and apply the change to your original dataframe.)

So generally speaking, if you want to work with the edited dataframe, get it from the widget output instead of Session State.

Here is an example of working with the edits (and even updating another column as a result of the edit): Data Editor Checkbox on Change - #2 by mathcatsand