Writing output from button to csv with pandas

First, many thanks for all the work in developing Streamlit - only just started using it, but its already a game-changer. Any assistance with the query below would be greatly appreciated.

Iโ€™m developing an app that will allow input for grades and feedback on student assignments. Displayed on the appโ€™s main page are .txt files displaying student texts and initial feedback. On the sidebar are radio and number_input fields for each .txt, allowing an instructor to leave engagement_comment and engagement_grade for each text. I can successfully display the layout per the code below.

What Iโ€™m uncertain of is how to write the output from these fields into a csv using pandas. Iโ€™ve created a sidebar.button (button1) that will enable recording of these fields into new columns engagement_comment and engagement_grade. But Iโ€™m uncertain how to structure the code to capture that output.

Hereโ€™s my working code:

import os
import streamlit as st
import pandas as pd

path, dirs, files = next(os.walk("TXTs"))
float_file_count = ((len(files)) / 3)
file_count = int(float_file_count)

txts = [f"TXTs\\feedback_{n}.txt" for n in range(file_count)]

st.set_page_config(layout="wide")

st.header("Demo - Level 3.6 (Prototype)")
st.sidebar.header("Grading Interface")
button1 = st.sidebar.button("Record comments and grades.")

def display_txts():
    for txt in txts:
        with open(txt, 'r', encoding="utf8") as infile:
            contents = infile.read()
            st.markdown(":point_right:  " + "**" + txt + "**" + "  :point_left:" + "\n\n" + contents)

def display_engagement():
    for txt in txts:
        engagement_comment = st.sidebar.radio("Engagement Comment: " + txt, ["Substantial engagement with text - good work.", "Satisfactory engagement with text.", "Little engagement with text - needs improvement."], key = txt)
        engagement_grade = st.sidebar.number_input("Engagement Grade: \n\n" + txt)

display_txts()

display_engagement()

if button1:

    df = pd.read_csv("Control2.csv")

    df['engagement_grade'] =  # <<<< here's where I'm stumped. What object do I place here?
    df['engagement_comment'] # <<<< same as above.

    df

    df.to_csv("Control2.csv", index=False)

    st.write("Grades and comments recorded. This process can be repeated as needed.")

Here is a picture of the app layout:

Streamlit version: version 0.85.1
Python: 3.9.2
OS: Windows 10
Browser: Chrome 92.0.4515.107