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 lab next week. In general, Mondays will be the day that you also turn in projects to get graded (on alternate weeks).

Try to complete Task 1 below by Monday; 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 it.


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 we will move to Jupyter Notebooks.


Check-in submission

Download the Task 1 code templates and test code below.

Code templates Test code
data.py test01_read_data.py
test02_read_data_errors.py
test03__str__.py
test04_get.py

Data

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

Dataset Files
Iris iris.csv
Bad Iris iris_bad.csv
Anscombe Quartet anscombe.csv
Spaces test test_data_spaces.csv
Complex test test_data_complex.csv

Don't skip reading this section

Important: 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 these notebooks. We give this to you to give you rapid feedback to help you make 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 data variables (ignore non-numeric columns of data).


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_data.py produces the expected results before moving onto test02_read_data_errors.py and so on.

  1. test01_read_data.py
  2. test02_read_data_errors.py
  3. test03__str__.py
  4. test04_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

Corrections


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

Submission


Checklist

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


Turning in your project

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

Submissions should be named as follows:


© 2021 Oliver Layton