{ "cells": [ { "cell_type": "markdown", "metadata": { "cell_id": "8f13e2c8-3b45-4d24-a34f-34b8c38db1af", "deepnote_cell_height": 418.375, "deepnote_cell_type": "markdown", "tags": [] }, "source": [ "# Week 7, Tuesday Discussion\n", "\n", "__Today:__\n", " - Pass back Quiz #3\n", " - Review for Quiz #4\n", " - Take Quiz #4\n", "\n", "__Reminders and Announcements:__\n", "- Homework #5 due tonight 11:59pm (don't forget about the opportunity for bonus points!)\n", "- This Thursday we will spend the first half of discussion working on Homework #6 _all together_; this will give you a head start on the homework, so be sure to join!\n", "- Midterm #2 next week during Thursday discussion\n", " - There will be no quiz Tuesday of Week 8, instead we will review for the midterm\n", " - I will pass out notecards during Thursday discussion this week" ] }, { "cell_type": "markdown", "metadata": { "cell_id": "094abe9dbb2d4c4daa8f07c06bc5b2bf", "deepnote_cell_height": 161.59375, "deepnote_cell_type": "markdown", "tags": [] }, "source": [ "__Question 1:__ \n", "\n", "Suppose `df` is the DataFrame shown below. Describe in words what the result of the following code will be.\n", "\n", "`df[\"Monday\"] = 0`\n", "\n", "\n", "`df.loc[df[\"Date].dt.day_name() == \"Monday\", \"Monday\"] = 1`" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "cell_id": "7f63cef2c5f748238ed7f9486c42a395", "deepnote_cell_height": 467, "deepnote_cell_type": "code", "deepnote_to_be_reexecuted": false, "execution_millis": 26473, "execution_start": 1652143927141, "source_hash": "b01f2b07", "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | Date | \n", "Fremont Bridge Total | \n", "Fremont Bridge East Sidewalk | \n", "Fremont Bridge West Sidewalk | \n", "
---|---|---|---|---|
0 | \n", "Friday | \n", "12.0 | \n", "7.0 | \n", "5.0 | \n", "
1 | \n", "Friday | \n", "7.0 | \n", "0.0 | \n", "7.0 | \n", "
2 | \n", "Friday | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "
3 | \n", "Friday | \n", "6.0 | \n", "6.0 | \n", "0.0 | \n", "
4 | \n", "Friday | \n", "6.0 | \n", "5.0 | \n", "1.0 | \n", "