Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| # Load the Excel sheet | |
| def load_data(file_path): | |
| # Load and clean the data | |
| df = pd.read_excel(file_path) | |
| df.columns = df.columns.str.strip() # Remove extra spaces | |
| return df | |
| # Load the data | |
| data = load_data("students_data.xlsx") # Replace with your actual path | |
| # Debugging | |
| st.write("Available Columns:", data.columns) | |
| st.write("Sample Data:", data.head()) | |
| # Streamlit UI | |
| st.title('Student Information System') | |
| # Input fields | |
| student_name = st.text_input('Enter Student Name') | |
| father_name = st.text_input('Enter Father Name') | |
| # Search | |
| if st.button('Search'): | |
| if student_name and father_name: | |
| # Normalize and search | |
| result = data[ | |
| (data['Student Name'].str.strip().str.lower() == student_name.strip().lower()) & | |
| (data['Father Name'].str.strip().str.lower() == father_name.strip().lower()) | |
| ] | |
| if not result.empty: | |
| st.write(result) | |
| else: | |
| st.error('No records found. Please check the inputs.') | |
| else: | |
| st.warning('Please provide both Student Name and Father Name.') | |