Skip to content
Snippets Groups Projects
Commit ac2cbef9 authored by Edward Mawuko Samlafo-Adams's avatar Edward Mawuko Samlafo-Adams
Browse files

widget for changing feature variables

parent 7af674e9
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -56,3 +56,37 @@ def app():
st.write(f"**Lowest Salary:** {min_salary:,.2f} EUR")
else:
st.warning("No numerical salary data available.")
# **New Section: Modify Feature Variables (Request 14)**
st.header("Modify Feature Variables")
st.write("Interactively update feature variables in the dataset.")
# **1. Modify Salary for a Specific Job**
st.write("### Modify Salary")
job_index = st.number_input("Enter the index of the job to update salary:", min_value=0, max_value=len(df) - 1, value=0)
new_salary = st.number_input("Enter the new salary (EUR):", min_value=0, max_value=200000, value=60000, step=1000)
if st.button("Update Salary"):
df.at[job_index, "Salary (Numeric)"] = new_salary
df.at[job_index, "Salary"] = f"{new_salary} EUR"
st.success(f"Updated salary for '{df.at[job_index, 'Job Opening Title']}' to {new_salary} EUR")
# **2. Change Job Status**
st.write("### Change Job Status")
selected_job_index = st.selectbox("Select a job to update status:", df.index)
new_status = st.selectbox("New Job Status:", ["Open", "Closed"])
if st.button("Update Job Status"):
df.at[selected_job_index, "Job Status"] = new_status
st.success(f"Updated job status for '{df.at[selected_job_index, 'Job Opening Title']}' to '{new_status}'")
# **3. Change Job Category**
st.write("### Change Job Category")
job_for_category_change = st.selectbox("Select a job to change category:", df.index)
new_category = st.text_input("Enter the new job category:", "Engineering")
if st.button("Update Job Category"):
df.at[job_for_category_change, "Category"] = new_category
st.success(f"Updated category for '{df.at[job_for_category_change, 'Job Opening Title']}' to '{new_category}'")
# Display the modified dataset
st.write("### Modified Job Listings")
st.dataframe(df.head(10))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment