Intermediate
120 mins
Teacher/Student led
+90 XP
Teacher-led from the board. Pupils do not need a device, but can follow on one.

Building Your Dataset and Charts

In this lesson you build the data side of your project, which covers BR1 and BR2 of the 2027 brief. You will set up a CSV file with a variety of data types, collect or simulate your records, clean them with Python, and make at least two different, clearly labelled charts with matplotlib, saving evidence for your report as you go.

Teacher Class Feed

Load previous activity

    1 - Objectives

    These lessons guide you through the Coursework Project. They are a guide only: the SEC's Coursework Project Brief 2027 is the authority, so always check what you do against it. Open the 2027 brief.

    By the end of this lesson you will have:

    • A CSV file with a header row and a variety of data types (we suggest at least four)
    • Enough records for meaningful searching and analysis (our advice: about 100 or more; the brief sets no number)
    • A cleaned dataset and a note of what you cleaned
    • At least two different, clearly labelled charts made with Python
    • Screenshots saved as evidence

    2 - Exact Basic Requirements You Must Meet

    BR1 Problem identification and gathering data

    • Identify a specific problem or need within school life.
    • Gather or create a relevant dataset: your own survey or recorded results, or realistic simulated data. No sensitive or personal data unless it has been anonymised and permission granted.
    • Clean and organise it so that it has a variety of appropriate and filterable data types.
    • Store it in a structured format, such as a CSV file, with enough records for meaningful searching and analysis.

    BR2 Data visualisation

    • Use Python to create at least two different data visualisations, for example a bar chart, line graph or pie chart.
    • Label each one clearly with a title, axis labels and a legend where appropriate.

    3 - Setting Up Your CSV File

    A CSV file is a table saved as plain text: one header row of field names, then one record per row, with commas between the values.

    id,year_group,survey_date,sleep_hours,study_hours,exercise_mins,plays_sport,mood
    1,1,2027-01-31,9.2,0.3,50,False,okay
    2,2,2027-01-30,6.8,1.4,66,True,low
    • Give every record a unique id.
    • Write dates the same way every time: YYYY-MM-DD.
    • Write booleans as True or False.
    • Keep text values from a fixed set of words, such as good, okay, low.
    • Use field names without spaces, such as sleep_hours.
    • Save the file as data/wellbeing.csv inside your Artefact folder.

    4 - Collecting or Simulating Your Data

    Collected data: run your survey with permission and without names, then export the answers as CSV.

    Simulated data: write a Python program that generates realistic records. This one makes 200:

    import csv
    import random
    from datetime import date, timedelta
    
    random.seed(2027)                      # the same "random" data every run
    start = date(2027, 1, 11)
    
    with open("data/wellbeing.csv", "w", newline="") as f:
        writer = csv.writer(f)
        writer.writerow(["id", "year_group", "survey_date", "sleep_hours",
                         "study_hours", "exercise_mins", "plays_sport", "mood"])
        for i in range(1, 201):            # 200 records
            year = random.randint(1, 6)
            sleep = round(random.uniform(5.0, 9.5), 1)
            study = round(random.uniform(0.0, 4.0), 1)
            sport = random.random() < 0.5
            exercise = random.randint(30, 120) if sport else random.randint(0, 60)
            mood = random.choice(["good", "okay", "low"])
            day = start + timedelta(days=random.randint(0, 27))
            writer.writerow([i, year, day.isoformat(), sleep, study,
                             exercise, sport, mood])

    Keep the values realistic: sleep between 5 and 9.5 hours, not 0 or 20. random.seed(2027) gives the same data every run, which makes testing easier.

    Simulated data only contains the patterns you put into it. If you build in a link, for example less sleep with lower mood, your analysis will find it. Say so in your report.
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more