Students Grades Database

Create students database with Python data app!

Students Grades Database

This application serves as a dashboard for managing a student scores database. It utilizes the Streamlit library, which simplifies web application development, and the Pandas library to work with tabular data. The primary goal is to present and interact with student scores data stored in a CSV file.

Data Input and Calculation

  1. Data Input: The code allows users to input data related to a student’s name, scores in four subjects (Maths, English, Science, History, Geography), and then calculates the total and average score. This part of the code focuses on collecting and processing user inputs, which include both text inputs (student’s name) and numeric inputs (subject scores).
  2. Grade Calculation: Based on the calculated average, the code assigns a grade to the student. This involves conditional statements (if-elif) that evaluate the average score and determine the corresponding grade (A+, A, B, etc.). The code demonstrates how to calculate grades based on specific conditions.

Data Presentation and Visualization

  1. Streamlit Layout Configuration: The code begins by configuring the Streamlit app’s layout to be wide using st.set_page_config(layout='wide'). This affects the visual presentation of the app, making it more user-friendly by utilizing the full width of the page.
  2. Data Presentation: The Pandas DataFrame (df) is used to load and display data from an external CSV file (‘scores.csv’). The st.dataframe function is employed to present this data within the Streamlit app. This section emphasizes the importance of visually representing data in a tabular format for easy user comprehension.
  3. User Inputs: The code utilizes Streamlit widgets such as st.text_input and st.number_input to allow users to input data interactively. This subtopic focuses on creating user-friendly forms and input fields for data entry.

Data Management and CSV Operations

  1. CSV File Handling: The code opens and reads an existing CSV file (‘scores.csv’) using Pandas. It demonstrates how to manage data by reading and working with external data sources, which is a crucial aspect of real-world applications.
  2. Data Update: After collecting and processing user inputs, the code adds a new student’s data to the existing data in the DataFrame (df). It uses the Pandas pd.concat function to concatenate the new student’s data with the existing DataFrame, effectively updating the dataset.
  3. CSV File Update: The code saves the updated DataFrame back to the CSV file (‘scores.csv’) using df.to_csv. This part of the code focuses on persisting and updating data in an external storage format (CSV), which is essential for data management in applications.

In summary, the code addresses the following subtopics:

Data Input and Calculation:

  • Collecting user inputs (text and numeric).
  • Calculating the total and average scores.
  • Assigning grades based on conditions.

Data Presentation and Visualization:

  • Configuring app layout for better user experience.
  • Displaying data using Pandas DataFrames.
  • Creating user-friendly input forms.

Data Management and CSV Operations:

  • Reading data from an external CSV file.
  • Updating and managing data using DataFrames.
  • Persisting data updates by saving to a CSV file.