Project activity 5: Python for Data Analytics
Project activity 5: Python for Data Analytics
Creating a Student Grade Tracker
In this project, we will create a simple student grade tracker using Python. We will utilize the concepts and libraries covered in Lessons 15 and 16, including the basics of the Python programming language, data manipulation and analysis using NumPy and pandas, and data visualization using Matplotlib. The project will involve creating a database to store student information and grades, performing data manipulation and analysis to calculate averages and generate reports, and visualizing the data using various plots.
Instructions:
- Database Setup:
– Install SQLite: If you don’t have SQLite installed, download and install it from the official SQLite website (https://www.sqlite.org/download.html).
– Create a Database: Create a new SQLite database file named “student_grades.db”.
- Create the Student Table:
– Create a table named “students” in the database to store student information.
– Define the following columns:
– “id” (integer, primary key): Student ID.
– “name” (text): Student name.
– “age” (integer): Student age.
– “gender” (text): Student gender.
- Create the Grades Table:
– Create a table named “grades” in the database to store student grades.
– Define the following columns:
– “id” (integer, primary key): Grade ID.
– “student_id” (integer, foreign key): Student ID (references the “id” column in the “students” table).
– “subject” (text): Subject name.
– “grade” (real): Grade obtained by the student in the subject.
- Populate the Database:
– Insert sample data into the “students” and “grades” tables to simulate student records and grades.
- Data Manipulation and Analysis:
– Write Python code to connect to the database and perform the following tasks:
– Retrieve student records and grades from the database.
– Calculate the average grade for each student.
– Identify the highest and lowest grades obtained across all subjects.
– Generate a report displaying the student names, average grades, and highest/lowest grades.
- Data Visualization:
– Utilize Matplotlib to create the following visualizations:
– Bar Plot: Display the average grades of students.
– Pie Chart: Show the distribution of grades across subjects.
- Display and Save the Plots:
– Display the created plots on the screen.
– Save the plots as image files for future reference.
- Finalize the Project:
– Write a brief summary and conclusion about the project, highlighting the importance of using Python libraries for data manipulation, analysis, and visualization.
Database Structure:
The database structure will consist of two tables: “students” and “grades”. The “students” table will store student information, including ID, name, age, and gender. The “grades” table will store student grades, including the subject name, grade, and a foreign key linking it to the student’s ID in the “students” table.
By following the instructions and completing the project, you will gain hands-on experience in working with databases, performing data manipulation and analysis using pandas and NumPy, and visualizing data using Matplotlib. This project will enhance your understanding of Python’s versatility in data analytics and provide a foundation for more advanced projects in the future.