Objectives

In this project, you will create a Python class called Data that will extract data from a CSV file. Beginning in the second week, you will use the numpy Python library to perform computations on numeric data, selected and organized by variable name, and use the matplotlib Python library to create a variety of different visualizations. In the final step of the project, you will use the tools that you implement to analyze a real world dataset of your choice. Throughout, you will practice common operations that will come up throughout the semester.

The goals are to:


Instructions


Please read all these instructions carefully!

Due date

Your first goal is to write a draft of the Data class to submit on Google Classroom next week. This is referred to as the Project 1 check-in. Please refer to the post on Google Classroom for the Project 1 check-in due date.

Try to complete through Task 1 below for the check-in. There might be bugs in your Data class and that's ok — you will have the chance to fix them in Week 2 without penalty. We will be grading your progress on Task 1:

Get started immediately on Task 1 — the first lecture of CS251 should be all that you need to complete most of it. The first lab will cover the rest (how to parse categorical data).


Task 0: Download data and code templates


To start the project, download the following code template (data.py), test code, and data CSV files.

NOTE: This week we will use Python test script files to check your code, but next week and beyond (Week 2+) we will move to Jupyter notebooks.


Check-in submission

Download the Task 1 code templates and test code below.

Code templates Test code Notes
data.py test01_read_numeric_data.py Tests handling of numeric data only
test02_read_data_errors.py
test03_read_cat_data.py Tests handling of both numeric and categorical data
test04_read_missing_data.py Tests handling of missing data
test05__str__.py Tests the "toString" method
test06_get.py Tests the Data class get methods.

Data

Download data used in the project below. Place the data in a subfolder of your working directory called data.

Dataset Files
Iris (Numeric variables only) iris_no_species.csv
Bad Iris iris_bad.csv
Iris iris.csv
Anscombe Quartet anscombe.csv
Spaces test test_data_spaces.csv
Complex test test_data_complex.csv
Numeric and categorical data test test_data_mixed_spaces.csv
Missing data test test_data_missing.csv
Spotify dataset spotify.csv

Don't skip reading this section

Important: In this class, it is important that you write code that conforms to the code template methods specifications exactly. This means that the parameter count, data types, return types must match the docstring specifications 100%. We grade by running test code, which includes what we give you in the above Python test scripts (and Jupyter notebooks in Weeks 2+). We give this to you to provide you with rapid feedback to help accelerate your progress. We may also have other test code that we use to grade, which makes similar assumptions. You will lose points if test code fails to run or returns incorrect results.

You should never have to modify test code!


Installing software

If you are working on your own computer, visit the Software page for installation instructions on Windows and macOS. Here is the minimum of what you need for Week 1:


Task 1: Data class


The Data class:

Overview of CSV files

Your Data class parses .csv data files. Here is the assumed structure of each .csv file:

Your Data object should only hold numeric and categorical data variables (ignore other columns of data in the CSV file).


1a. Overview of Data class

Implement the following methods in data.py (also see Task 1b. Testing your code).


1b. Testing your code

As you go, run the following test scripts to check the correctness of your code (Download above). Check them in order — verify test01_read_numeric_data.py produces the expected results before moving onto test02_read_data_errors.py and so on.

  1. test01_read_numeric_data.py
  2. test02_read_data_errors.py
  3. test03_read_cat_data.py
  4. test04_read_missing_data.py
  5. test05__str__.py
  6. test06_get.py

Note about Test 2

Running test02_read_data_errors.py should produce a crash. The goal is to understand why this happens and to inform the user what problem occurs and how to correct it. -->

Task 2+: (Week 2)


Starting this week, all project instructions are in a Jupyter notebook. Download the following notebook and code template to get started on the next few tasks.

Remember: final submissions should include updated versions of your draft code.

Notebooks Code templates
analysis.ipynb analysis.py

Create a subfolder in your Project 1 working directory named images. Download the following image and copy it into the images subfolder.

Images Description
pairplot_bottomleft.png Format of the bottom-left pair plot.

Corrections


Please check here for any corrections to the project instructions or test code.

Submission

Naming

Recall the naming scheme for project and lab submissions:

  1. Place your lab in a folder whose name includes your Colby user name. For example, I would place my project folder inside one called owlayton.
  2. Create a ZIP file out of the folder that has your Colby username in it. For example, mine would be called owlayton.zip.

Following these naming guidelines greatly helps us grade your labs and projects! We may take points off your project if you repeatedly do not follow this convention when submitting.

Checklist

Before you turn in your project, did you...

Turning in your project

To turn in check-in (draft) and final project submissions, you should create a .ZIP file and upload it to Google classroom. The .ZIP file should:

Extensions

You should not turn in any code related to extensions in your base project submission. This is important because project and extensions will be graded by different people. Turn in your video extensions (5 minute video recording + code) via the separate Google Classroom Assignment under the Project Extensions section.


© 2026 Oliver Layton, Stephanie Taylor