Worksheet 0#

The json file produced at the end of this worksheet should be submitted on Canvas by Tuesday of Week 1, before discussion section.

Question#

  • If you haven’t already, join our (free) Deepnote workspace using your UCI email address. (Ask William or Chris if you need a new invitation; the invitations do eventually expire.)

  • Find 1-2 other students to work with. (To get full credit on this assignment, you need to work with at least one other student. This group is just for this assignment.)

  • One student in your group should create a new workspace:

  1. Click the arrow next to your name at the top left.

  2. Click the plus icon next to your email address.

  3. Select “Free for students and teachers” at the bottom center.

  4. Select “Education plan”.

  5. Name the workspace something like “Week 0 group”.

  6. Once the workspace is created, invite your other group members to your workspace (click on “Setting & members” on the left) and give them “Editor” (rather than “Viewer”) access.

  7. Duplicate this Deepnote project into your newly formed workspace (click on the … next to Worksheet 0 on the left-hand side, and select Duplicate project).

Question#

  • Create an account on Kaggle using your UCI email address.

  • Download this Vending machines dataset.

  • Unzip the resulting zip file, and upload the vending machines dataset (the csv file) into this project. Change its file name to vend.csv. (Click the plus icon next to the Files list on the right-hand side. Once the file is uploaded, click the … next to the file name and rename the file to vend.csv.)

  • Load the data from that csv file into this notebook using the following code. (Put the code into a new code cell, and then execute the code cell by hitting Shift+Return, just like in Mathematica. The best way to learn this sort of code is to type it yourself, rather than using copy-paste.)

import pandas as pd
df = pd.read_csv("vend.csv")
  • Look at the first 10 rows of the dataset using the following command. df.head(10)

Question#

  • Find another dataset on Kaggle that you think looks interesting.

  • Insert a link to this dataset in a new markdown cell below this cell. (You can find the shortcut for inserting a new markdown cell by clicking on “Chat & resources” on the left side, and then clicking on “Shortcuts”.) Use the following markdown link syntax: [Text to display](URL). If the link isn’t clickable, then something went wrong.

Question#

Get a link to share this notebook by performing the following steps.

  • Click the Share & publish link at the top right.

  • Enable public sharing.

  • Change the sharing permissions from View to Comment.

Question#

Make a Python dictionary with the variable name d and with the following contents.

  • The key "names" and the corresponding value a list containing the full names (as strings) of everyone in your group. A list is indicated using square brackets like this mylist = [0,1,2], and strings are enclosed in single or double quotation marks, like this "I am a string" or like this 'So am I'.

  • The key "emails" and the corresponding value a list containing the UCI email addresses (as strings) of everyone in your group. Put the email addresses in the same order as the names in the previous step.

  • The key "rows" and the corresponding value the number of rows in df. This number should be an integer, not a string (so don’t put it in quotation marks). You can find the number of rows using df.shape (the first number in the tuple is the number of rows) or len(df) or just by evaluating df on its own and letting Deepnote tell you how many rows there are.

  • The key "link" and the corresponding value is the link you created above (as a string).

Question#

  • Save this Python dictionary as a json file using the following code.

import json

with open("sub0.json", "w") as f:
    json.dump(d, f)
  • Notice how, after a few seconds, a new file shows up in the files section with the name “sub0.json”. Download this file by clicking the dots next to the file name on the right side.

  • Upload this json file as your submission for the Worksheet 0 assignment on Canvas.

Created in deepnote.com Created in Deepnote