Lab 7: Dictionaries
In this lab, you will analyze water accessibility data using dictionaries.
Corrections/Clarifications
None yet
Find any issues? Report to us:
- Hakan Dingenc dingenc@wisc.edu
- Aidan Seeberg aseeberg@wisc.edu
Learning Objectives
In this lab, you will practice how to...
- Access and utilize data in CSV files
- Deal with messy real-world datasets
- Use dictionaries to organize data into key, value pairs
Note on Academic Misconduct
You may do these lab exercises only with your project partner; you are not allowed to start working on lab-p5 with one person, then do the project with a different partner. Now may be a good time to review our course policies.
Project Partner
We strongly recommend students find a project partner. Pair programming is a great way to learn from a fellow student. Project difficulty increases exponentially in this course. Finding a project partner early on during the semester is a good idea.
If you are still looking for a project partner, take a moment to ask around the room if anyone would like to partner with you on this project. Then you can work with them on this lab and the project.
Segment 1: Setup
Create a lab-p7
directory and download the following files into the lab-p7
directory.
water_accessibility.csv
practice.ipynb
practice_test.py
If you found your .csv
file is downloaded as a .txt
file (e.g. water_accessibility.txt
instead of water_accessibility.csv
), run mv water_accessibility.txt water_accessibility.csv
from your Powershell/Terminal to change the extension of the file into .csv
file manually. All the data that we need for p7 is stored in water_accessibility.csv
To start, familiarize yourself with the dataset (water_accessibility.csv
). Examine its contents using Microsoft Excel, Numbers (Mac) or any other spreadsheet viewing software.
Segments 2: Using dictionaries to analyze the data
You will be finishing the rest of your lab on practice.ipynb
. Run the command jupyter notebook
from your Terminal/PowerShell window.
Remember not to close this
Terminal/PowerShell window while Jupyter is running, and open a new Terminal/PowerShell
window if necessary.
Note: For p7, you will be working on p7.ipynb
, which is very similar to practice.ipynb
. We
strongly recommend that you finish working on this notebook during the lab, so you can ask
your TA/PM any questions about the notebook that may arise.
Note: Unlike p7.ipynb
, you do not have to submit practice.ipynb
. This notebook is solely
for your practice and preparation for p7.
Segment 3: Otter tests check for project submission
This segment is informational only and has no tasks. Your work on p7.ipynb
is not complete when you submit the project on Gradescope. It is your responsibility to make sure that your project clears auto-grader tests on the Gradescope test system. Otter test results should be available in a few minutes after your submission. You should be able to see both PASS / FAIL results for the 20 test cases and your total score, which is accessible via Gradescope Dashboard. You must be able to see the following screen on Gradescope:

You must review the project's rubric and make sure that you have followed the directions provided in the project to solve the questions. The rubric is meant to reinforce your understanding of the project's directions. TAs and graders will be following the rubric to make deductions on your project submission during manual grading. Rubrics will become progressively stricter as we make progress during this semester.
Project 7
You can now get started with p7. You may use any helper functions created here in project p7. Remember to only work with p7 with your partner from this point on. Have fun!