commit e50f7ec594decf421c6c30bb3c32ae59b4e8ccb8 Author: louiscklaw Date: Sat Feb 1 02:02:54 2025 +0800 update, diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d54c38a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,31 @@ +*.mp4 filter=lfs diff=lfs merge=lfs +*.zip filter=lfs diff=lfs merge=lfs +*.7z filter=lfs diff=lfs merge=lfs +*.tar.gz filter=lfs diff=lfs merge=lfs +*.jpg filter=lfs diff=lfs merge=lfs +*.png filter=lfs diff=lfs merge=lfs +*.avif filter=lfs diff=lfs merge=lfs +*.webm filter=lfs diff=lfs merge=lfs +*.mkv filter=lfs diff=lfs merge=lfs + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +*.gif filter=lfs diff=lfs merge=lfs +*.GIF filter=lfs diff=lfs merge=lfs +*.bmp filter=lfs diff=lfs merge=lfs +*.BMP filter=lfs diff=lfs merge=lfs +*.tiff filter=lfs diff=lfs merge=lfs +*.TIFF filter=lfs diff=lfs merge=lfs +*.wav filter=lfs diff=lfs merge=lfs +*.WAV filter=lfs diff=lfs merge=lfs +*.log filter=lfs diff=lfs merge=lfs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67a5a14 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/~*.* \ No newline at end of file diff --git a/ISOM3400_asg1.pdf b/ISOM3400_asg1.pdf new file mode 100644 index 0000000..4a2b9c0 Binary files /dev/null and b/ISOM3400_asg1.pdf differ diff --git a/course_materials/Topic_1_Python_Basics_(with answers).ipynb b/course_materials/Topic_1_Python_Basics_(with answers).ipynb new file mode 100644 index 0000000..76d446f --- /dev/null +++ b/course_materials/Topic_1_Python_Basics_(with answers).ipynb @@ -0,0 +1,5020 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "WoU1nZS_dk7v" + }, + "source": [ + "[What’s Markdown?](https://www.markdownguide.org/getting-started)\n", + "\n", + "- Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. You add Markdown syntax to the text to indicate which words and phrases should look different.\n", + "- For example, to denote a heading, you add a number sign before it (e.g., # Heading One). Or to make a phrase bold, you add two asterisks before and after it (e.g., **this text is bold**).\n", + "\n", + "[Basic Syntax](https://www.markdownguide.org/basic-syntax/)\n", + "- Headings, paragraphs, line breaks, emphasis (e.g., bold, italic), lists (ordered and unordered), ..." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Phm288_2QuAB" + }, + "source": [ + "
\n", + "\n", + "# 1 Operators\n", + "\n", + "In Python, we can directly write *expressions* and Python will generate the results for experessions. Expressions are typically comprised of *operators* and *values*.\n", + "- *operators* are a set of special symbols that carry out computations.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "iWWlM-PuoUjY" + }, + "source": [ + "## 1.1 Arithmetic Operators\n", + "\n", + "The *arithmetic operators* `+`, `-`, `*`, `/`, and `**` perform addition, subtraction, multiplication, division, and exponentiation:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "RypeFqFAPtDt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d00fe752-9362-4994-afd5-0ad30b7b3062" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5.2" + ] + }, + "metadata": {}, + "execution_count": 1 + } + ], + "source": [ + "1.2 + 2 + 2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "QsLURoqWQAzT", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f7efc613-c940-495f-9976-dc4bf9ecd580" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "10" + ] + }, + "metadata": {}, + "execution_count": 2 + } + ], + "source": [ + "5 * 2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "JnpFbh7vQCWC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0ed1fe74-8e7f-486e-d07b-5241ee8cd6b0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "25" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "5 ** 2 # 5 squared" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "XCmg3g_rfYbW" + }, + "source": [ + "Parentheses `()` can be used for grouping:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "avNCWAiGP_Qq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b80706ca-61a1-4e95-ecbe-8d5d06ade6f3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "2.0" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "(15 - 10) * 2 / 5" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "cbbMUKsJXCwi", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "5ed5004f-ee43-44d0-fb0f-67716d6a1933" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "25" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ], + "source": [ + "5 * (3 + 2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "YcKk6JkSQj6C", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2574af58-32d2-4945-9e86-d893e0c64c79" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5.666666666666667" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "17 / 3 # division; always return a result with a fractional part" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "wPt_dVQ6QVmq" + }, + "source": [ + "The `//` operator performs *integer or floored division* that keeps only the integer part of the result, while the `%` operator calculates the remainder:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Cd-L6HR6TFOB", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "74cf92e9-aee3-4f09-defc-e498e9754733" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "17 // 3 # floor division; discard the fractional part" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "720mFJnqQlV-", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "82a57643-58c3-4239-cab3-23ca2101d54d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "2" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ], + "source": [ + "17 % 3 # mod; return the remainder of the division" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "B5aV3QPIXUnM" + }, + "source": [ + "*Exercise:* From your math classes, you should know $a^2-b^2=(a-b)(a+b)$. Using this information to calculate the result of $19^2-18^2$ in at least two ways." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "5K0SiwgNXcEV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4c9ab10b-45c2-4360-c150-619e7c26a4fa" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "37" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ], + "source": [ + "# write your codes here, the first way\n", + "19 ** 2 - 18 **2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "3jD4Y8SzXe-a", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "5cfe7e5f-23bb-4841-ffad-35b7f9634033" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "37" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ], + "source": [ + "# the second way\n", + "(19 + 18) * (19 - 18)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "A1w94yVqoed7" + }, + "source": [ + "## 1.2 Comparison Operators\n", + "\n", + "*Comparison (relational) operators* are used to compare values on either sides of them. It returns either of the two *Boolean* values, `True` and `False`.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "KanNkLafVKso" + }, + "source": [ + "The table summarizes comparision operators:\n", + "\n", + "| Operator | Meaning |\n", + "|----|---|\n", + "| == | Equal to - `True` if both operands are equal |\n", + "| != | Not equal to - `True` if operands are not equal |\n", + "| < | Less than - `True` if left operand is less than the right |\n", + "| > | Greater than - `True` if left operand is greater than the right |\n", + "| <= | Less than or equal to - `True` if left operand is less than or equal to the right |\n", + "| >= | Greater than or equal to - `True` if left operand is greater than or equal to the right |\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "eqSarpzPWPZM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "eed1d946-f029-4947-dede-5275996dada4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "2 <= 5" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "vmzrggo7WSjN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d238af36-6dad-4240-f2a9-60c5263329f4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "# chained in the mathematically obvious way\n", + "# it can only be written as 2 < 5 and 5 <= 5.0 in other languages\n", + "\n", + "2 < 5 <= 5.0" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "hbJDcS_BcxBA" + }, + "source": [ + "*Exercise:* Try to compare whether \"hello\" is equal to \"Hello\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "W9qapqupc5AT", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ead54b27-bded-413a-b5b0-631368d59a2b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ], + "source": [ + "# write your codes here\n", + "\"hello\" == \"Hello\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "y5nz76vPkgP0" + }, + "source": [ + "## 1.3 Logical Operators\n", + "\n", + "\n", + "### Boolean Values: `True` and `False`\n", + "\n", + "\n", + "In computer science, the **Boolean data type** (`bool` for short in Python) is a data type that can only take on two truth values, `True` or `False`, intended to represent the truth values of logic and Boolean algebra.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "VYSPDvrnkgP1", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e823aeed-8f7e-49fe-e34b-00881fea2ac8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ], + "source": [ + "True # reserved keywords" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "kREZmZddkgP1", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "106bcfe5-6158-4f3a-d593-4c84f1347379" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ], + "source": [ + "False # reserved keywords" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2vmnOtMUWmA0" + }, + "source": [ + "*Logical (Boolean) operators* (`and`, `or` and `not`) perform Boolean logic upon two Boolean expressions and return Boolean results (`True` or `False`).\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "bz1ePYtCXu98" + }, + "source": [ + "Logical operators in Python are summarized as follows. The order indicates the relative levels of precedence (ordered by descending priority):\n", + "\n", + "\n", + "|Operator|Meaning|\n", + "|:-- |:-- |\n", + "|not|True if operand is false (complements the operand)|\n", + "|and|True if both the operands are true|\n", + "|or|True if either of the operands is true|\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "PVa40u5bXILc", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "644fc777-1a5a-477b-8444-630b675f3b7f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ], + "source": [ + "not True # only require one operand" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "SNXGO_KSXL4E", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "265b4e9a-23eb-4790-b329-ed78adfe50ef" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "False or False" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6jpZRDSZeM93" + }, + "source": [ + "*Exerciese:* Do not run the following codes first, predict the returned results of `2 < 5 and not False` and `2 < 5 and 5 < 5.0 or 5 < 1024`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ERI2aU_-XPgc", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a93809df-7e0a-4d77-fc45-9c8950d6d79a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 18 + } + ], + "source": [ + "2 < 5 and not False" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7HFvKyHUXjn0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "efe44a88-43af-4e96-f10c-b539607659e6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 19 + } + ], + "source": [ + "2 < 5 and 5 < 5.0 or 5 < 1024" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MXNENMdEgh03" + }, + "source": [ + "
\n", + "\n", + "# 2 Objects and Their Types\n", + "\n", + "Everything in Python is an object, and every object has an *identity*, a *type*, and a *value*.\n", + "\n", + "Python's built-in data types can be found at: https://www.w3schools.com/python/python_datatypes.asp\n", + "\n", + " \n", + "\n", + "The built-in function `type()` returns an object's type:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ZeDbgQoLhKFw", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3ec6a378-b69e-4cd4-b5f2-059db1a90f85" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "bool" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ], + "source": [ + "type(True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "m7r7GK88hWB_", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "58336c23-e3ae-4d51-e199-e5586a421fa6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "int" + ] + }, + "metadata": {}, + "execution_count": 21 + } + ], + "source": [ + "type(5**2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "gTz9SEcohd-R", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6dca313b-4fbc-4abf-e4f7-d23d7c9ea108" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "float" + ] + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "type(2.0) # with a decimal point" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "LgnagsKHhfsR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3ddaf437-94f6-4e74-a517-f78c41e4cc27" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "float" + ] + }, + "metadata": {}, + "execution_count": 23 + } + ], + "source": [ + "type(3.8e15) # with an exponent; base 10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "g42KHqNVkgP8", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c8d9f9d9-e498-4f43-8636-67f75a28b037" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "float" + ] + }, + "metadata": {}, + "execution_count": 24 + } + ], + "source": [ + "type(15 / 5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jNQXiSAegDNV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ea91589b-cf1c-47ef-a795-8bb3a3c8a2e6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3.0" + ] + }, + "metadata": {}, + "execution_count": 25 + } + ], + "source": [ + "15/5" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "mmB_ePaskgP9", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7b5ddf01-6707-49a2-d1d9-847e9493645e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "int" + ] + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "type(17 // 5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hXTO9tk2kgP-", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dab64cb5-8eec-4e14-917a-34867e7a998d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "int" + ] + }, + "metadata": {}, + "execution_count": 27 + } + ], + "source": [ + "type(17 % 3)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5tYQ9MsV_Uxa" + }, + "source": [ + "\n", + "\n", + "\n", + "An object's *type* determines:\n", + "\n", + "- A domain of possible values, e.g.:\n", + "\n", + " - The `bool` type has only two values, i.e., `True` and `False`;\n", + " - The `int` type represents whole numbers (e.g., `1`, `2`, `-34`, `1024`);\n", + " - The numbers with a decimal point or an exponent (or both) (e.g., `2.0`, `3.2`, `.3`, `3.8e15`) have type `float` (short for floating-point numbers).\n", + " \n", + "- A set of possible operations that can be performed on these values (e.g., arithmetic operations like `+`, `-`, `*`, etc.).\n", + "\n", + "\n", + "\n", + "More genrally, everything in Python is an object.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "sf62xwIpbAn5" + }, + "source": [ + "
\n", + "\n", + "# 3 Variables\n", + "\n", + "One of the most powerful features of a programming language is the ability to manipulate *variables*. In Python, a variable is ***a name that refers to an object***." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6IvwVp2AzfmM" + }, + "source": [ + "## 3.1 Declare Variables\n", + "\n", + "Using the equal sign (`=`), an assignment statement defines a variable by\n", + "\n", + "- Evaluating the expression on the right of `=` to construct a new or retrieve an existing object;\n", + "\n", + "- Binding a name on the left of `=` to the object." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "SBENOmJyze4n" + }, + "outputs": [], + "source": [ + "width = 10" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "wLgxlKXn_9dn" + }, + "source": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KFRBAU07z1dP" + }, + "outputs": [], + "source": [ + "height = 12" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "bF5DNkdIATfY" + }, + "source": [ + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "AKut-oZOAnJP" + }, + "source": [ + "When we enter a name in Python, it gives us back the object bound to it:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "kvZtrnqTAmJa", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "007eeda7-5b35-472f-f494-ef5a0929a55b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "10" + ] + }, + "metadata": {}, + "execution_count": 30 + } + ], + "source": [ + "width" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7-cKOPfaAyW7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "cf6f7046-2ef2-4463-d05f-eef52cc9e447" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "12" + ] + }, + "metadata": {}, + "execution_count": 31 + } + ], + "source": [ + "height" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "MjR9TY7XA3cn" + }, + "outputs": [], + "source": [ + "area = width * height" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "tlLM4RJLBC9g" + }, + "source": [ + "\n", + "\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "X2j-k9u4BUVd", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4e8973c3-7fc4-4e90-c3a6-f07c2f785bfa" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "120" + ] + }, + "metadata": {}, + "execution_count": 33 + } + ], + "source": [ + "area" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "QikJF5GOBe99" + }, + "outputs": [], + "source": [ + "width = width + 5" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "irIEx66tBiM5" + }, + "source": [ + "\n", + "\n", + "\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "h6MRm9TPBhZh", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3ec35745-e9c8-41e7-8ae6-9f5b742457b6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "15" + ] + }, + "metadata": {}, + "execution_count": 35 + } + ], + "source": [ + "width" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "On_EWQlKB8iD" + }, + "source": [ + "\n", + "## 3.2 Compound/Augmented Assignment Operators\n", + "\n", + "`width = width + 5` examplifies a very common operation. Python provides a shorthand operator, `+=`, to express it more cleanly:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "4L5qnWhITmeO", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6da7e4a6-d7cf-4fe9-c5c0-ba681895100e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "20" + ] + }, + "metadata": {}, + "execution_count": 36 + } + ], + "source": [ + "width += 5\n", + "width" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0-4_9z7MTpob" + }, + "source": [ + "Similar *compound/augmented assignment operators* include `-=`, `*=`, `%=`, and so on:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "gOXuHqraT8L1", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f2b02950-951d-4ba5-f51a-97cb1402e3eb" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "4.0" + ] + }, + "metadata": {}, + "execution_count": 37 + } + ], + "source": [ + "width /= 5; width" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "O7ONE_IvCyxZ" + }, + "source": [ + "** Question **: What is the value of `j` after evaluating `i += 7`?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "WvRorN0xlMSn", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "db9f1f63-38ca-46e1-c77a-a70be81551fe" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "i= 12\n", + "j= 5\n" + ] + } + ], + "source": [ + "i = 5\n", + "j = i\n", + "i += 7\n", + "\n", + "#write codes to check value of i and j\n", + "print(\"i=\", i)\n", + "print(\"j=\", j)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "p3cs5dftIv8n" + }, + "source": [ + "\n", + "\n", + "## 3.3 Naming Conventions\n", + "\n", + "Python has some rules to follow when forming a variable name:\n", + "\n", + "- Can contain both letters (uppercase or lowercase), digits (but cannot start with a number), and the underscore character (_).\n", + "\n", + "- Python's keywords cannot be used as variable names, because the Python interpreter uses them to recognize the structure of the program." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ShlXtEoPkgQO", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "58a37b95-0266-4a70-f51d-7be9da0b4054" + }, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "cannot assign to True (, line 1)", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m True = 49.2\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m cannot assign to True\n" + ] + } + ], + "source": [ + "True = 49.2" + ] + }, + { + "cell_type": "markdown", + "source": [ + "Python also provides a keyword module for working with Python keywords in a programmatic way. `kwlist` provides a list of all the Python keywords for the version of Python you’re running." + ], + "metadata": { + "id": "xLfiwOo6MUFU" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_tnr7Se7IzzC", + "outputId": "2625394c-1b66-4415-c776-f311d4186bcc" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['False',\n", + " 'None',\n", + " 'True',\n", + " 'and',\n", + " 'as',\n", + " 'assert',\n", + " 'async',\n", + " 'await',\n", + " 'break',\n", + " 'class',\n", + " 'continue',\n", + " 'def',\n", + " 'del',\n", + " 'elif',\n", + " 'else',\n", + " 'except',\n", + " 'finally',\n", + " 'for',\n", + " 'from',\n", + " 'global',\n", + " 'if',\n", + " 'import',\n", + " 'in',\n", + " 'is',\n", + " 'lambda',\n", + " 'nonlocal',\n", + " 'not',\n", + " 'or',\n", + " 'pass',\n", + " 'raise',\n", + " 'return',\n", + " 'try',\n", + " 'while',\n", + " 'with',\n", + " 'yield']" + ] + }, + "metadata": {}, + "execution_count": 40 + } + ], + "source": [ + "import keyword\n", + "keyword.kwlist" + ] + }, + { + "cell_type": "code", + "source": [ + "len(keyword.kwlist)" + ], + "metadata": { + "id": "WDEGWzr4M2Jd", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d75149db-9449-447f-d00d-7ad257e6f998" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "35" + ] + }, + "metadata": {}, + "execution_count": 41 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Me5gSdwFmAHN" + }, + "source": [ + "*Exercise:* Try to **violate** each naming rules by defining several new variables" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "flPCDbYel82z", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "bd71a9cb-93ff-4fdd-dadf-007eb9a4e2f3" + }, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "invalid decimal literal (, line 2)", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m 1day = 'Monday'\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid decimal literal\n" + ] + } + ], + "source": [ + "# write your codes here\n", + "1day = 'Monday'" + ] + }, + { + "cell_type": "code", + "source": [ + "course$ = 100" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "id": "DYSeBUjLOskk", + "outputId": "62231c40-741f-4e15-d24e-74324d47f5b0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m course$ = 100\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "i4CtL_zIJBGl" + }, + "source": [ + "A good coding style requires a variable name to be ***descriptive*** and ***mnemonic***." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "cufjK1xrkgQP" + }, + "outputs": [], + "source": [ + "course_name = \"Business Applications Development in Python\"\n", + "course_code = \"ISOM3400\"\n", + "course_is_elective = True" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "KmMYRvsjKOgV" + }, + "source": [ + "\n", + "## 3.4 Namespaces\n", + "\n", + "A *namespace* is a *mapping from names to objects* in a specific programming context, and can be conceptualized as an \"invisible dictionary\".\n", + "\n", + "The built-in function `dir()`, when called without arguments,\n", + "returns the list of all the names (functions and variables) belonging to the namespace from where it is called.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "eLtxL5ERkgRD" + }, + "outputs": [], + "source": [ + "a_trial_variable = 'will be deleted soon'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "1iBiLVbUkgRD", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d61d53b9-7818-435e-d431-da5d31196699" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['In', 'Out', '_', '_1', '_10', '_11', '_12', '_13', '_14', '_15', '_16', '_17', '_18', '_19', '_2', '_20', '_21', '_22', '_23', '_24', '_25', '_26', '_27', '_3', '_30', '_31', '_33', '_35', '_36', '_37', '_4', '_40', '_41', '_5', '_6', '_7', '_8', '_9', '__', '___', '__builtin__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_dh', '_i', '_i1', '_i10', '_i11', '_i12', '_i13', '_i14', '_i15', '_i16', '_i17', '_i18', '_i19', '_i2', '_i20', '_i21', '_i22', '_i23', '_i24', '_i25', '_i26', '_i27', '_i28', '_i29', '_i3', '_i30', '_i31', '_i32', '_i33', '_i34', '_i35', '_i36', '_i37', '_i38', '_i39', '_i4', '_i40', '_i41', '_i42', '_i43', '_i44', '_i45', '_i5', '_i6', '_i7', '_i8', '_i9', '_ih', '_ii', '_iii', '_oh', 'a_trial_variable', 'area', 'exit', 'get_ipython', 'height', 'i', 'j', 'keyword', 'quit', 'width']\n" + ] + } + ], + "source": [ + "print(dir())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Es2CpRk1pfA3" + }, + "source": [ + "Deleting a name using [the `del` statement](https://docs.python.org/3/reference/simple_stmts.html#del) removes the name from the namespace:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "GUQ9DH8rpjgH" + }, + "outputs": [], + "source": [ + "del a_trial_variable" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "euHag_VlqBiV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6fca2356-268f-45fc-f5ed-f475f12f7553" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['In', 'Out', '_', '_1', '_10', '_11', '_12', '_13', '_14', '_15', '_16', '_17', '_18', '_19', '_2', '_20', '_21', '_22', '_23', '_24', '_25', '_26', '_27', '_3', '_30', '_31', '_33', '_35', '_36', '_37', '_4', '_40', '_41', '_5', '_6', '_7', '_8', '_9', '__', '___', '__builtin__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_dh', '_i', '_i1', '_i10', '_i11', '_i12', '_i13', '_i14', '_i15', '_i16', '_i17', '_i18', '_i19', '_i2', '_i20', '_i21', '_i22', '_i23', '_i24', '_i25', '_i26', '_i27', '_i28', '_i29', '_i3', '_i30', '_i31', '_i32', '_i33', '_i34', '_i35', '_i36', '_i37', '_i38', '_i39', '_i4', '_i40', '_i41', '_i42', '_i43', '_i44', '_i45', '_i46', '_i47', '_i5', '_i6', '_i7', '_i8', '_i9', '_ih', '_ii', '_iii', '_oh', 'area', 'exit', 'get_ipython', 'height', 'i', 'j', 'keyword', 'quit', 'width']\n" + ] + } + ], + "source": [ + "print(dir())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "eNxfVQDLkgRF", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 176 + }, + "outputId": "b5a1babc-8e46-4c9e-d6a2-77098a4ccd55" + }, + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "name 'a_trial_variable' is not defined", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ma_trial_variable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'a_trial_variable' is not defined" + ] + } + ], + "source": [ + "a_trial_variable" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "UrBXNrXAqJVg" + }, + "source": [ + "When objects become unreachable, they can be garbage-collected." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "M9I_J0oShEYH" + }, + "source": [ + "
\n", + "\n", + "# 4 Functions" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Xro--X1T3eTI" + }, + "source": [ + "> Programming = Data + Function" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "u6HfueVZjpKJ" + }, + "source": [ + "A function is a machine which turns input objects (called the arguments) into an output object (called the return value), according to a definite rule (defined somewhere for this function).\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JrxKY81ZKC29" + }, + "source": [ + "\n", + "\n", + "We can draw an analogy of a programming function to a mathematical function.\n", + "\n", + "\n", + "\n", + "Consider $f(a,b)=a^2+b^2$:\n", + "\n", + "- A function definition usually associates a name (i.e., $f$) with a sequence of statements that performs a computation (i.e., $a^2+b^2$).\n", + "\n", + "- Once a function is defined, we can \"call\" it by name with necessary inputs provided (i.e., $f(3,5)$).\n", + "\n", + "- When a function is called or invoked, Python goes back and looks up its definition, executes the code inside the function definition (i.e., $3^2+5^2$), and return an output (i.e., $34$)." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MZQ6tHCEkisI" + }, + "source": [ + "Python provides a number of [**built-in functions**](https://docs.python.org/3/library/functions.html) that we can use without needs to provide the function definition as well as import a module:\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Mnv9aYZojO0f", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ce55c851-a074-4ab2-82b9-0183271cf5ab" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "hello world\n" + ] + } + ], + "source": [ + "print('hello world') # print object" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "cjNAbpeEkh5T", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c6c94ee5-3a85-4ee3-c21c-2d3a6ab75295" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5.11" + ] + }, + "metadata": {}, + "execution_count": 50 + } + ], + "source": [ + "abs(-5.11) # return the absolute value of a number" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "N1ZsRVzojTwL", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3c9b7028-6cb1-4725-a9fa-053a511f30c4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "4.56" + ] + }, + "metadata": {}, + "execution_count": 51 + } + ], + "source": [ + "round(4.55892, 2) # return number (1st argument) rounded to ndigits (2nd argument) precision after the decimal point." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "grA9RkhcciRw", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b1e19868-ee3d-4c67-8db4-db2069bb9d48" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "8" + ] + }, + "metadata": {}, + "execution_count": 52 + } + ], + "source": [ + "pow(2, 3) # return base (1st argument) to the power exp (2nd argument)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "CSakjCYCkpQw", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "42850447-9909-443c-d4ef-f04b837278f5" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 53 + } + ], + "source": [ + "max(1, 2, 3, 4, 5) # return the largest item" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "4DKmmVGZkrGr", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "bc6456c6-7906-4562-de72-21e03c119d90" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1" + ] + }, + "metadata": {}, + "execution_count": 54 + } + ], + "source": [ + "min(1, 2, 3, 4, 5) # return the smallest item" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "sDxEWDKoku3I", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "161fe355-b0ff-4543-b9bb-f9608a18efd7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(4, 1)" + ] + }, + "metadata": {}, + "execution_count": 55 + } + ], + "source": [ + "divmod(9, 2) # return the quotient and remainder when using integer division" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "V2Rzriz9lTba" + }, + "source": [ + "Typing a function's name without `()` echos \"the value\" or more precisely the **string representation** of the function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "qBN9YyLJlT7p", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "bc91d4d7-c413-497f-8629-37412ac66a2c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 57 + } + ], + "source": [ + "max" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MGbmYUX6k6cy" + }, + "source": [ + "If the usage of a function is unknown, we can call `help()` to print help for the function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ToI27i89k53w", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "045dd0bd-1a47-43b2-d9eb-a0b0caf196bd" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Help on built-in function max in module builtins:\n", + "\n", + "max(...)\n", + " max(iterable, *[, default=obj, key=func]) -> value\n", + " max(arg1, arg2, *args, *[, key=func]) -> value\n", + " \n", + " With a single iterable argument, return its biggest item. The\n", + " default keyword-only argument specifies an object to return if\n", + " the provided iterable is empty.\n", + " With two or more arguments, return the largest argument.\n", + "\n" + ] + } + ], + "source": [ + "help(max)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QNvvdDDqiwVD" + }, + "source": [ + "
\n", + "\n", + "# 5 Strings\n", + "\n", + "Besides numbers and Booleans, Python can also manipulate strings, which are sequences of characters.\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "CRrNZhsscuSF" + }, + "source": [ + "\n", + "## 5.1 String Literals\n", + "\n", + "Strings are constructed by enclosing a sequence of characters in single quotes (`'`) or double quotes (`\"`):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "V6Ti7K6MjIgz", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "399993c0-66ea-422d-e261-1c8684e779a2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Welcome to Python Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 61 + } + ], + "source": [ + "'Welcome to Python Programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "AfnfgbhzjL-G", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "5cddf2ac-7f8b-4e99-a55b-5705e1fddcc4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Welcome to Python Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 59 + } + ], + "source": [ + "\"Welcome to Python Programming\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "F1eHBZnWjbw-" + }, + "source": [ + " Single quoted strings can contain double quotes, and vice versa" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Ba1AIO3ijbBV" + }, + "outputs": [], + "source": [ + "\"Programming isn't hard.\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "9H-jsam6jx62" + }, + "outputs": [], + "source": [ + "'\"Yes\", they said.'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "T87y5hj0oMbG" + }, + "outputs": [], + "source": [ + "strr='\"Yes\", they said.' # assign this string to a variable strr" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7E7icLAZoQK6", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "1b506e4c-6228-4bc0-8bc5-4a0b53bbcacc" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'\"Yes\", they said.'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 63 + } + ], + "source": [ + "strr" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "c6pInT4pjLMw" + }, + "source": [ + "** Question **: What if we have to use single (double) quotes literally in a single(double)-quoted string? Escape their special behaviors with backslashes (`\\`):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "-AwV8aCilKaa", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "e688465e-c0db-4404-f626-2d038dcc88fe" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'\"No, it isn\\'t\", they said'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 66 + } + ], + "source": [ + "'\"No, it isn\\'t\", they said'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "nNfogqwso04V" + }, + "source": [ + "*Exercise:* Try to create a string value with both single and double quotes, and check what you will get by not using backslash to escape the quotes." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "xDFmB_gRo3Cf", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "43b68f7f-f3a8-4a5e-ba66-13cc7368951c" + }, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "unterminated string literal (detected at line 2) (, line 2)", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m 'Jenny told me, \"Charels didn't come yesterday\"'\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unterminated string literal (detected at line 2)\n" + ] + } + ], + "source": [ + "# write your codes here\n", + "'Jenny told me, \"Charels didn't come yesterday\"'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "LpMpaBA_oE7M" + }, + "source": [ + "When we press the Enter key, a *newline character* (`\\n`) is generated to signify the end of a line. But Python uses newlines to delineate statements.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "J4GTuWvnJmFf", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "092e91c0-e001-4141-e6d7-ed04bfbcfd4c" + }, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "unterminated string literal (detected at line 1) (, line 1)", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 'Python Programming\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unterminated string literal (detected at line 1)\n" + ] + } + ], + "source": [ + "'Python Programming\n", + "for Business Analytics'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "j5cdIus6oRVt" + }, + "source": [ + "\n", + "\n", + "\n", + "One way to make a string literal span multiple lines is to write it inside triple quotes, `\"\"\"` or `'''`:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Pn3HvXgNkgQZ", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "5f4a3597-8dc9-4d5a-f1af-6b0641664593" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming\\nfor Business Analytics'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 70 + } + ], + "source": [ + "'''Python Programming\n", + "for Business Analytics''' # a newline (\\n) is automatically included in it" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "80Z6XJTd2w1p" + }, + "source": [ + "We can also use `()` to combine multiple string literals (possibly spanning multiple lines) into one:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "glLybREa2vga", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "15b5ff98-5f14-4272-e5e6-99b49573acd7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming for Business Analytics'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 71 + } + ], + "source": [ + "(\"Python Programming \"\n", + "\"for Business Analytics\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "F0xQ03GJozSo" + }, + "source": [ + "`print()` is used to display the actual content represented by a string literal:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "IbVBCtkaorVQ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "57bf2c50-148b-4938-ecdc-8dc8f2410320" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Python Programming\n", + "for Business Analytics\n" + ] + } + ], + "source": [ + "print('Python Programming\\nfor Business Analytics')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "3-m8yOGEkIrs" + }, + "source": [ + "\n", + "## 5.2 Escape Sequences\n", + "\n", + "An *escape sequence* (of characters) can be used to denote a special character which cannot be typed easily on a keyboard or one which has been reserved for other purposes.\n", + "\n", + "Some common escape sequences include:\n", + "\n", + "|Sequence|Meaning|\n", + "|:-- |:-- |\n", + "|`\\\\`|literal backslash|\n", + "|`\\'`|single quote|\n", + "|`\\\"`|double quote|\n", + "|`\\t`|tab|\n", + "|`\\n`|newline|" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "FEdpi9m0qKLV" + }, + "source": [ + "** Question **: How to print the following using escape sequences:\n", + "\n", + "`I don't think \"a\" is equal to \"A\" in 'Python'`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "wE0BJQ0hjQH7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c9cc4f59-36ab-49e5-8006-fd86dca82ee5" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "I don't think \"a\" is equal to \"A\" in 'Python'\n" + ] + } + ], + "source": [ + "print('I don\\'t think \"a\" is equal to \"A\" in \\'Python\\'') # write the string here" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ABgZhk3XsBu6" + }, + "source": [ + "We can make a string literal span multiple lines by including a backslash character \\ at the end of each line to escape the newline (\\n):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "lNzPg2qBsE28", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "76b25717-191e-416f-f2dd-c7d9ee1914f4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming for Business Analytics'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 74 + } + ], + "source": [ + "'Python Programming \\\n", + "for Business Analytics'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "jl_Af1ZYsN9y" + }, + "source": [ + "*Exercise:* Try to predict what the string will be like if we print it\n", + "\n", + "```\n", + "\"\\\"Python is fast enough for our site and allows us to produce maintainable features in record times, \\\n", + "with a minimum of developers,\\\" \\n said Cuong Do, Software Architect, YouTube.com.\"\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jgfuQVafsuCU", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ea8ae637-8740-4907-8f67-ec9f1dc16e9c" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\"Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers,\" \n", + " said Cuong Do, Software Architect, YouTube.com.\n" + ] + } + ], + "source": [ + "# write codes to verify your prediction\n", + "print(\"\\\"Python is fast enough for our site and allows us to produce maintainable features in record times, \\\n", + "with a minimum of developers,\\\" \\n said Cuong Do, Software Architect, YouTube.com.\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MzJ4RGl1lMwa" + }, + "source": [ + "\n", + "## 5.3 String Operations\n", + "\n", + "In Python, strings have type `str`, which is a special kind of *sequence types*. String objects support several operations and built-in functions.\n", + "\n", + "### 5.3.1 Concatenating and multiplying strings\n", + "\n", + "- The operators `+` and `*` works with strings:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "v8RTOGqalwQW" + }, + "outputs": [], + "source": [ + "course = 'Python Programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "wlmfuAmluW54", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "b03b9a49-6738-4189-bb1e-b331900a8e0e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming for Business Analtytics'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "course + ' for Business Analtytics'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "O80E3g01l0Pa", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "78bfa3f3-9b67-4314-f2fc-78c1198f7ad6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python ProgrammingPython Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "course * 2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_PB18VyAuf-3" + }, + "source": [ + "- `-` and `/`, however, are incompatible with the `str` type:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "FQWULEMuunYD", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "7a878934-4c5a-4d65-e33d-ed0c330be02d" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unsupported operand type(s) for -: 'str' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcourse\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0;34m'Programming'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for -: 'str' and 'str'" + ] + } + ], + "source": [ + "course - 'Programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "MiJQ5z8EupAJ", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "838e867a-6de9-4886-bee3-384bf9a94475" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unsupported operand type(s) for /: 'str' and 'int'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcourse\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for /: 'str' and 'int'" + ] + } + ], + "source": [ + "course / 2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2gjSArIFutQ9" + }, + "source": [ + "*Exercise:* Use two strings s1=“little \" s2=\"lamb \" to create a new string s3=\"little lamb little lamb \" by using string concatenation and multiplication." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "2ugD6Wp5zxIx", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "39975659-50e8-449b-f0c3-646066a4b4be" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'little lamb little lamb '" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "# write your codes here\n", + "s1=\"little \"\n", + "s2=\"lamb \"\n", + "s3 = (s1 + s2) * 2\n", + "s3" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Tth7Ic6ymM1y" + }, + "source": [ + "### 5.3.2 Check substrings\n", + "\n", + "- The *membership operators* `in` and `not in` take two strings and return `True` if the first appears as a substring in the second:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7a2vrvYhmjfl", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3094dc0e-55b2-4f05-b0b6-0bf06336c865" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ], + "source": [ + "'nan' not in 'banana'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "5Hb9ckxummUb", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d4e38ec0-2dd2-4733-d131-176bee6160e1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ], + "source": [ + "'p' in 'Python Programming'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "T2IBxjwtmx48" + }, + "source": [ + "### 5.3.3 Comparing strings\n", + "\n", + "- The comparison operators (e.g., `==`, `>`, `<=`) compare strings ***lexicographically***, the way in which sequences are ordered based on the *alphabetical order* of their component characters:\n", + "\n", + " - In alphabetical ordering, digits come before letters and capital letters come before lowercase letters.\n", + " - i.e., digits (as characters) < uppercase letters < lowercase letters.\n", + " - Compare the leftmost characters first, and generate `True` or `False` if their values differ, or continue until a difference is observed." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "E-VLsEzgmvbc", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b1d970b8-ad89-43d4-f88a-f309490b70f6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "'Python Programming' == 'python programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Up93Axsuo_Pi", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e717f9fc-8984-48c2-fc70-afff28e06fe5" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "'Python Programming' < 'python programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KXD159w4pCht", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "471dafcb-02d4-409e-de60-5f30b7121ac4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ], + "source": [ + "'python programming' < 'python cookbook'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "chPFfcJKByV_", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4c4aae07-93b1-4e75-f846-99875daf78a9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ], + "source": [ + "'9999' < 'A'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MM1HpZt5pIw8" + }, + "source": [ + "### 5.3.4 String length\n", + "\n", + "- `len()` returns the number of characters in a string:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jIagmUnFpNnz", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8d422611-226e-46e6-c536-cab13f036adb" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Python Programming\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "18" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ], + "source": [ + "print(course)\n", + "len(course)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "CfSuSowBpPre", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "31c37c52-0fca-4d8b-c8b2-95ae9f3c853f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "4" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ], + "source": [ + "len('True')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "N1Zw0rpG4mrH" + }, + "source": [ + "### 5.3.5 String Indexing\n", + "\n", + "A string is a sequence of characters, and is ***reducible*** to the component characters.\n", + "\n", + "The characters in a string are indexed by integers (representing positions in the sequence), and can be individually accessed by using the indexing operator (`[]` that encloses an integer).\n", + "\n", + "The index set contains the integers 0, 1, …, and `len()-1` (*0-based indexing*).\n", + "\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "RLnvuuSw53f8", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "e1325b0d-7536-460f-976d-225312972ab5" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "course" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "_xoI_dRr56Tv", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "d38a0164-cd93-433a-f7a3-62094927f9f9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'t'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 18 + } + ], + "source": [ + "course[2]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "T7x8Hz4A5-3w" + }, + "source": [ + "Strings can also be ***back indexed*** using negative integers. Negative indexing counts backward from the end of a sequence and starts from `-1`.\n", + "- i.e., `-1` refers to the last character, `-2` refers to the second-to-last character, and so on" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "X68-bRkA6Fh0", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "195f51a4-701a-4665-d9db-416dda3d66f2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'P'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 19 + } + ], + "source": [ + "course[-3*6]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Yhman6Jv6Klu" + }, + "source": [ + "Out of range indexing will incur an error:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "iBDoFEpw6LsF", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "e0c35790-9fd1-479e-c3d5-ca23b7d1c6c3" + }, + "outputs": [ + { + "output_type": "error", + "ename": "IndexError", + "evalue": "string index out of range", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcourse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m18\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mIndexError\u001b[0m: string index out of range" + ] + } + ], + "source": [ + "course[18]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "h5AsSro86OrJ" + }, + "source": [ + "*Exercise:* get the first 'o' and the second 'o' in the string course with both positive and negative index." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "kU2im5Pd6Rpt", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "2d77f3e7-62df-4b88-f2c2-bdfe2aba19ec" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'o'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "# write your codes here\n", + "course[4]; course[-14]\n", + "course[9]; course[-9]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "KWE8nfX86aNf" + }, + "source": [ + "### 5.3.6 String Slicing\n", + "\n", + "\n", + "Slicing is an operation that extracts a segment of a string (called a **slice**).\n", + "\n", + "The slicing operator `[i:j]` returns the part of the sequence from the element indexed by `i` to the element indexed by `j`, including the first but excluding the last:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "aibL-fcC6lMs", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "beb89edc-aaef-40c9-efa3-f06e9141298f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 23 + } + ], + "source": [ + "course[0:6]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "q6c693ym6oWg", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "c7bf0021-8627-4354-af8c-e4386183a657" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 24 + } + ], + "source": [ + "course[-18:-12]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "M0CPaHvJ6twD", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "af2b9e2e-acb3-4321-b20b-cc9bc0f8c5ea" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 25 + } + ], + "source": [ + "course[0:-12]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Qjwp09Nl6xpM", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "843a14d4-be09-4788-c9f9-087ef49f8f22" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "course[-11:18]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "L3DxydUZ65K2" + }, + "source": [ + "If the 1st argument is omitted, the slice starts at the beginning of the string; if the 2nd argument is omitted, the slice goes to the end of the string:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "6m5KtA8_7BdB", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "25ace502-739b-45e0-e76d-8a5939ab0618" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 27 + } + ], + "source": [ + "course[-11:]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7_hS-20n7DiW", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "8eab6cda-c7b8-4050-abb4-6bbbe76ac4c0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 28 + } + ], + "source": [ + "course[:-12]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "LW_RC-957F56", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "feae7bb4-6e1b-4741-93ec-f3389b2b0d3c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "course[:]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "rh9KHLG17Juj" + }, + "source": [ + "*Exericse:* use slicing to get the substring `gram`. Try at least two methods( e.g. positive index, negative index)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "rIJabpSf7L1F", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "d89a59cf-2817-45f3-b73b-5f933af6b75f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'gram'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 31 + } + ], + "source": [ + "#write your codes here\n", + "course[10:14]\n", + "course[-8:-4]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qV-nUdd77cXn" + }, + "source": [ + "## 5.3.7 Strings are Immutable\n", + "\n", + "Strings in Python is ***immutable***. That is, the value of string objects cannot change:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "fT027R0B7gUh", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "c6679f08-d8e3-4818-af7c-bec75dca67a1" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'str' object does not support item assignment", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcourse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m7\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'p'\u001b[0m \u001b[0;31m# Modifying characters isn't allowed.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" + ] + } + ], + "source": [ + "course[7] = 'p' # Modifying characters isn't allowed." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6IE0u0x-7jNc" + }, + "source": [ + "However, this does not mean that we can't change the value of a variable (more precisely, the object that a name refers to). We can assign the variable a new string:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "F1EmKR5-7m1r" + }, + "outputs": [], + "source": [ + "course = 'ISOM 3400'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6lmZf_Sf7647" + }, + "source": [ + "\n", + "\n", + "An object's *mutability* is determined by its type. Numbers and Booleans are also immutable (we will see some mutable data types later)." + ] + }, + { + "cell_type": "code", + "source": [ + "course = 'Python programming'\n", + "course" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "id": "p_Ngl0c8zW_o", + "outputId": "0a3127a7-50b4-427b-8eeb-7a331cebcdd2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 34 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "e7hSEzRM1xBw" + }, + "source": [ + "
\n", + "\n", + "## 5.4 String Formatting\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "WhDJ3QT9yqBh" + }, + "outputs": [], + "source": [ + "# using semicolon allows us to write multiple statements on the same line\n", + "shares = 3.2; stock = 'Apple'; price = 443.05" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "NP3gQO8siTNR" + }, + "source": [ + "To display the contents of these variables, we can pass them as a comma-separated list of argument to `print()`. By default, `print()` separates the content of each argument by a single space and appends a newline to the end of the output:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "sRr5FHF_iv_M", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4b897992-5c77-4536-dd9e-a5f7def5e223" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "purchase 3.2 shares of Apple at $ 443.05 per share\n" + ] + } + ], + "source": [ + "print('purchase', shares, 'shares of', stock, \"at $\", price, 'per share')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "i664F9yR4XG1", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fffae324-e607-4608-980d-0ec062e5fb83" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Help on built-in function print in module builtins:\n", + "\n", + "print(...)\n", + " print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n", + " \n", + " Prints the values to a stream, or to sys.stdout by default.\n", + " Optional keyword arguments:\n", + " file: a file-like object (stream); defaults to the current sys.stdout.\n", + " sep: string inserted between values, default a space.\n", + " end: string appended after the last value, default a newline.\n", + " flush: whether to forcibly flush the stream.\n", + "\n" + ] + } + ], + "source": [ + "# access the help system\n", + "help(print)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "oBBnpQhgkFHZ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d7b86e16-6acb-4974-b312-e4c839870d5b" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "purchase 3.2 shares of Apple at $ 443.05 per share\tpurchase-3.2-shares of-Apple-at $-443.05-per share\n" + ] + } + ], + "source": [ + "print('purchase', shares, 'shares of', stock, \"at $\", price, 'per share', end='\\t')\n", + "print('purchase', shares, 'shares of', stock, \"at $\", price, 'per share', sep='-')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "X8s7OvLskM_2" + }, + "outputs": [], + "source": [ + "with open(\"printout.txt\", \"w\") as f:\n", + " print('purchase', shares, 'shares of', stock, \"at $\", price, 'per share', sep='-', file=f)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "-IOXuP6NiChW" + }, + "source": [ + "`print() ` supports ouput formatting that is rudimentary at best. In many cases, we'll need more precise control over the appearance of data destined for display.\n", + "\n", + "Python provides several ways to format strings:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ctXjoHEWEil6" + }, + "outputs": [], + "source": [ + "f'purchase {shares} shares of {stock} at ${price:.1f} per share' # f-string" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "dvXe9cIlN-SV" + }, + "outputs": [], + "source": [ + "'purchase {} shares of {} at ${:.1f} per share'.format(shares, stock, price) # format method (optional)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "IUWp27fKlwfx" + }, + "outputs": [], + "source": [ + "'purchase %d shares of %s at $%.1f per share' % (shares, stock, price) # the % operator; old-style string formatting (optional)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xfbI4Mk2EKBO" + }, + "source": [ + "\n", + "### 5.4.1 f-strings\n", + "\n", + "\n", + "\n", + "Python 3.6 added a new string formatting approach called **formatted string literals** or **f-strings**, which provides a simple way to substitute values into strings.\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "EMKUainZKQHP", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "803e1b58-b827-49be-9118-67305629ef88" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Five divided by ten is 50.00%'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 41 + } + ], + "source": [ + "a = 5; b = 10\n", + "f\"Five divided by ten is {a / b :.2%}\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "YZtyz4IszltG", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "4d00c022-c72f-453e-b15b-8bb24823d1a4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'purchase 11.4 shares of Google at $203.830000 per share'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 42 + } + ], + "source": [ + "# Format specifiers are optional\n", + "stock = 'Google'; price = 203.83; shares = 11.4\n", + "f'purchase {shares} shares of {stock} at ${price:f} per share' # The default precision of 'f' is 6." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "XTl3vHW1F547" + }, + "source": [ + "In order to make a brace appear in your string, we must use double braces:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "HNkdoin3F49y", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "f7a229bd-2b17-4470-d08a-c6cc75bdc8c6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'{a + b}'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 43 + } + ], + "source": [ + "f\"{{a + b}}\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "6yj_LV-pF_TQ", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "28e211a2-1a03-4ac3-b574-0615f54089d7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'{15}'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 44 + } + ], + "source": [ + "f\"{{{a + b}}}\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lYmP0xZza9xy" + }, + "source": [ + "\n", + "#### Optional: Format Specifications\n", + "\n", + "The structure of a format specifier is shown as follows:\n", + "\n", + "\n", + "` [[]][][#][0][][][.][]`\n", + "\n", + "```\n", + "fill : \n", + "align : \"<\" | \">\" | \"=\" | \"^\"\n", + "sign : \"+\" | \"-\" | \" \"\n", + "width : digit+\n", + "grouping_option : \"_\" | \",\"\n", + "precision : digit+\n", + "type : \"b\" | \"c\" | \"d\" | \"e\" | \"E\" | \"f\" | \"F\" | \"g\" | \"G\" | \"n\" | \"o\" | \"s\" | \"x\" | \"X\" | \"%\"\n", + "```\n", + "\n", + "A format specficiation is introduced by a colon `:` that optionally follows the name or position of the argument to be assigned to the replacement field.\n", + "\n", + "More details on the new-style string formatting syntax can be found here.\n" + ] + }, + { + "cell_type": "code", + "source": [ + "stock = 'Google'; price = 203.83; shares = 11.4\n", + "f'purchase {shares:.2f} shares of {stock:>10} at ${price:.2e} per share'" + ], + "metadata": { + "id": "euy0bsgOgXLZ", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "519dfecd-d705-4765-b963-7060e519d791" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'purchase 11.40 shares of Google at $2.04e+02 per share'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 45 + } + ] + }, + { + "cell_type": "code", + "source": [ + "stock = 'Google'; percentage = 0.1845; week = 52.3\n", + "f\"{stock:e<12}'s stock is trading {percentage:.1%} off of {week:.0f}-week highs\"" + ], + "metadata": { + "id": "VBmSUdYPgYAS", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "6edbd80b-fd2f-4fa6-87ee-16514803db78" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "\"Googleeeeeee's stock is trading 18.4% off of 52-week highs\"" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 46 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Suppose you have a variable year=2021 (int type) and a variable month=7 (int type), how you can generate a date string such as “Now it is 2021.07”?" + ], + "metadata": { + "id": "BC-YpDmFZ2ca" + } + }, + { + "cell_type": "code", + "source": [ + " #write your codes here\n", + "year = 2021\n", + "month = 7\n", + "f\"Now it is {year}.{month:0>2d}\"" + ], + "metadata": { + "id": "6ccGVnPTZ4pb", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "2d1661a6-097c-4065-e8c1-a2e99f93a20b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Now it is 2021.07'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 48 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Amq06mGJIxHy" + }, + "source": [ + "### (Optional) 5.4.2 The Method Approach: `str.format()`\n", + "\n", + "\n", + "Formatting can also be handled by calling `.format()` on a string object. The syntax is similar to the one we used with f-strings:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "xeYfahm4Iwdb" + }, + "outputs": [], + "source": [ + "# Simple positional formatting\n", + "'purchase {} shares of {} at $ {} per share'.format(shares, stock, price)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "0D1owWVKWIXq" + }, + "outputs": [], + "source": [ + "# Rearranging the order of display\n", + "'purchase {2} shares of {0} at $ {1:.1f} per share'.format('Google', 203.83, 11.4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "_7Gawa7PJOqO" + }, + "outputs": [], + "source": [ + "# Maching by name\n", + "'purchase {shares} shares of {stock} at $ {price} per share'.format(stock='Google', price=203.83, shares=11.4)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "u0m6hhSg7YU7" + }, + "source": [ + "### (Optional) 5.4.3 \"Old Style\": The `%` Operator\n", + "\n", + " `%` is known as the ***formatting/interpolation operator***. It lets us do simple positional formatting easily.\n", + "\n", + "The operator takes the ***conversion specifiers*** (starting with `%`) on the left and the values on the right, producing a formatted string:\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "hjz62xgnDrSz" + }, + "source": [ + "- In addition to representing the string interpolation operation, the `%` character also denotes the conversion specifiers, e.g., `%d`, `%s`, and `%.0f`, and the replacement fields in a format string.\n", + "- Each value is converted to a string value with the specified format and inserted into the format string in place of the corresponding replacement field (matched by position).\n", + "- More rules can be found at: https://docs.python.org/2/library/stdtypes.html#string-formatting" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QaC72Tn46WXl" + }, + "source": [ + "\n", + "#### Conversion Specifiers\n", + "\n", + "A conversion specifier contains 2 (% and a letter specifying conversion type; required) or more (optional) characters (allowing for more fine-grained control over how values are printed) to determine how values are formatted when they’re inserted:\n", + "\n", + "The constructs of a conversion specifier is structured as follows:\n", + "\n", + "`%[][][.]`\n", + "\n", + "\n", + "|Component|Meaning|Possible Values|\n", + "|:-- |:-- |:--|\n", + "|`%`|Introduces the conversion specifier|\n", + "|``|Indicates the type of conversion to be performed|`d` for decimal integers
`f` for floating point numbers
`e` for exponential numbers
`s` for strings\n", + "|`.`|Determines the length and precision of outputs|\n", + "|``|Specifies the minimum width of the formatted result|\n", + "|``|Indicates one or more flags that exert finer control over formatting|`0` for padding of values
`-` for justification of values\n", + "\n", + "\n", + "
\n", + "\n", + "
\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "owdb4-EPElxE" + }, + "source": [ + "In most cases, we just use %s, %f, %d, etc as the conversion specifiers." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "yfazLbxRC6UU" + }, + "outputs": [], + "source": [ + "'purchase %d shares of %s at $%f per share' % (shares, stock, price) # The default precision of 'f' is 6." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "w6p457VHExbF" + }, + "source": [ + "**More usages**\n", + "\n", + "When we want to control **the length (for string values) or precision of values**, use `%.d/f/s`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Cdn85PlMEwVJ" + }, + "outputs": [], + "source": [ + "'purchase %.6d shares of %.3s at $ %.0f per share' % (shares, stock, price)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PALruLGAE7Fe" + }, + "source": [ + "When we want to control the width of the placeholder" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "43W_wADzJmHC" + }, + "outputs": [], + "source": [ + "'purchase %-6d shares of %-10s at $%.2e per share' % (shares, stock, price)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lK2w-VQABHbZ" + }, + "source": [ + "To insert a literal `%` character into the output, specify two consecutive `%` characters in the format string:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "QdAMo1B9HHhI" + }, + "outputs": [], + "source": [ + "\"%s's stock is trading %.0f%% off of %d-week highs\" % ('Google', 0.1845 * 100, 52.3)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WR7QepOrRdNt" + }, + "source": [ + "## 5.5 Accepting User Inputs\n", + "\n", + "Programs often need to obtain data from the user, usually by way of input from the keyboard. The simplest way to accomplish this in Python is with `input()`.\n", + "\n", + "`input(prompt)` prompts for and returns input as a string. We can assign what is returned into a variable, to be used later." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Rl_4vK_4RuFt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "584f9e8c-2189-47d6-8f3a-20099d786a78" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What is your name? Jing\n", + "What is your age? 38\n", + "What is your gender? female\n" + ] + } + ], + "source": [ + "name = input(\"What is your name? \")\n", + "age = input(\"What is your age? \")\n", + "gender = input(\"What is your gender? \")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Rk3RsypYR0Tr", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "74cd2e6e-08fd-46a4-8b89-3c38afcadf32" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'38'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 50 + } + ], + "source": [ + "age" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "bQ0H7xZ7R2Se", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "da182704-44c5-46cc-dddd-6137ae742341" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "str" + ] + }, + "metadata": {}, + "execution_count": 51 + } + ], + "source": [ + "type(age)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ARe7vFI3R49s" + }, + "source": [ + "To display the contents of these variables, pass them as a comma-separated list of argument to `print()`. By default, `print()` separates the content of each argument by a single space and appends a newline to the end of the output:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "GYH7emBqR9-s", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a0afc921-5b68-434d-f907-15601051881f" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Jing is female at 38 years old.\n" + ] + } + ], + "source": [ + "print(name, 'is', gender, 'at', age, 'years old.')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "qkPzJe9NSOGo" + }, + "outputs": [], + "source": [ + "help(print)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MFxxW4UkSWf0" + }, + "source": [ + "Try other usage of print() function" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jBfJuG1JSY5Y" + }, + "outputs": [], + "source": [ + "print(name, 'is', gender, sep='-', end='\\t')\n", + "print('at', age, 'years old.', sep='-')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "SvqzSsSRSkcH" + }, + "source": [ + "*Exercise*: Write a program to prompt the user to input the length and width of a rectangle with some prompt messages. Then calculate the area of the rectangle and print the result to the user with appropriate messages." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "HSpMdvCTSqa6" + }, + "outputs": [], + "source": [ + "#write your codes here\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "jqxjuXfZmDAp" + }, + "source": [ + "
\n", + "\n", + "# 6 Type Conversion\n", + "\n", + "\n", + "Built-in functions like `str()`, `int()`, `bool()`, and `float()` will try to convert anything to their respective types:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Qo02se6s4HpG", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "9e1277f7-6290-4ef2-f761-130a558e7e26" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unsupported operand type(s) for +: 'int' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m3\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m'4'\u001b[0m \u001b[0;31m# add or concatenate?\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'int' and 'str'" + ] + } + ], + "source": [ + "3 + '4' # add or concatenate?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "nBtWRCxK3hUQ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6e6a5f2d-4da6-4729-83d9-d7fe195ce661" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "7" + ] + }, + "metadata": {}, + "execution_count": 54 + } + ], + "source": [ + "int(\"3\") + 4 # Now the ambiguity is cleared up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "e0nSEUwe3jId", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "bee07692-c46c-4bb4-c6ca-9cbbef45645e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'3.4'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 55 + } + ], + "source": [ + "'3.' + str(4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "2b4YlOk43tm9", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9ac77aac-d96d-4147-cc86-31d9543076d7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "execution_count": 56 + } + ], + "source": [ + "int(float(\"3.4\")) # try int(\"3.4\")" + ] + }, + { + "cell_type": "code", + "source": [ + "int(\"3.4\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "id": "xIEOnjeN6pA6", + "outputId": "e69fac77-71df-409b-a121-d2fff1f52f2d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: '3.4'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"3.4\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: '3.4'" + ] + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "rkL5i1893u-7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3dfd7fb9-e1c2-4e8c-af25-4d5e49b675cd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 58 + } + ], + "source": [ + "bool(0) # return an object's truth value" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "N08Txf-_4CiT", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "12077506-bc1c-49f9-9cb7-f4ac823b63bb" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 59 + } + ], + "source": [ + "bool(-3.4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "OseDYKl73w9j", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e503fcb5-3ec1-44ce-ef93-021013d9b81f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 60 + } + ], + "source": [ + "bool(\"\") # An empty string is false" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "E0xNGUkS3-N8", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "cd70f4e6-2121-41db-9e82-fcadb13cbe3f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 61 + } + ], + "source": [ + "bool(\"False\") # A non-empty string counts as True" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Xb3oDNHE4CF3", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 175 + }, + "outputId": "61a7ce2e-0c9a-4547-f44d-0a7c71b6c41b" + }, + "outputs": [ + { + "output_type": "error", + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: 'I have $3.8 in my pocket'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'I have $3.8 in my pocket'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# nonsensical conversion\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'I have $3.8 in my pocket'" + ] + } + ], + "source": [ + "int('I have $3.8 in my pocket') # nonsensical conversion" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "YXXEWI7oN3Ly" + }, + "source": [ + "*Exercise:* Try to debug the following program so that it works reasonably." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hVuNpcxYN5jG", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "788f4f4c-1190-4ae7-ab20-ad7d80a4ae44" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "please input an integer: 20\n", + "After adding 10 the result would be 30\n" + ] + } + ], + "source": [ + "# Try to correct the codes\n", + "number = input('please input an integer: ')\n", + "print(f'After adding 10 the result would be {int(number) + 10}')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qtIERvN0VEYy" + }, + "source": [ + "
\n", + "\n", + "# 7 Methods\n", + "\n", + "\n", + "A method is an ***object-oriented*** programming term, and refers to a function that is attached to and act upon a specific object (thereby considered an attribute of the object).\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "bz-AsfODz1OU" + }, + "source": [ + "\n", + "## 7.1 Method Invocation\n", + "\n", + "Like functions, methods are triggered with a call expression.\n", + "\n", + "A method call requires the *attribute reference* notation, i.e., a dot (`.`) between the invocation target and the method name:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "8bL385TVWXkS" + }, + "outputs": [], + "source": [ + "course = 'Python Programming'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "aGwvhbZcWPR9", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "d6677b07-0e70-4ceb-9420-03bd8542c404" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'python programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 66 + } + ], + "source": [ + "course.lower()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "D2gABWF7Wa27", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f8b7ccf0-642c-479e-ad62-b5bd4452b878" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 67 + } + ], + "source": [ + "(12.3).is_integer() # E.g., 12.3 is not; try (12).is_integer()" + ] + }, + { + "cell_type": "code", + "source": [ + "(12.0).is_integer()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "nqzZishL8OS9", + "outputId": "a422cf31-15bf-4bc0-d811-12fd6f3e36cb" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 69 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "F5-PW7ZapFJj" + }, + "source": [ + " Any name following a dot can be called an **attribute**.\n", + "\n", + "\n", + " As a rule of thumb, Python's toolset is ***layered***:\n", + "\n", + "- Generic operations that span multiple types show up as built-in functions or expressions (e.g., `len(x)`, `x[0]`);\n", + "\n", + "- Type-specific operations are implemented as method calls." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_A1EVluSYfRd" + }, + "source": [ + "Again, typing a method's name without adding `()` echos the string representation of the method:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "FndDveaeYj33", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8bae9cfa-cb42-4bc9-e367-c97fa75f3fc7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 70 + } + ], + "source": [ + "course.split" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Cng2VJbPPXu_", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "22a999c8-423f-4ca6-8e94-a4dd51a0ad4f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Python', 'Programming']" + ] + }, + "metadata": {}, + "execution_count": 71 + } + ], + "source": [ + "course.split()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WBHyDQt9XoJD" + }, + "source": [ + "\n", + "---\n", + "\n", + "
\n", + "\n", + "## 7.2 Getting Help on Methods\n", + "\n", + "We can use the built-in function `dir(object)` to retrieve a list of all the attributes (including methods, which are *function attributes*) available for any object passed to it:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "g-Qrmd_zYE8N", + "outputId": "0b21efc0-bf17-456b-853a-111b5fc3469f" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(course))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Z6FSGhkpYQBh" + }, + "source": [ + "To learn about each method, we can pass them to the `help()` function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "-E5dE4XYYPVK", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9dbb902e-4aef-4866-d8ac-8664cec7faf5" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Help on built-in function split:\n", + "\n", + "split(sep=None, maxsplit=-1) method of builtins.str instance\n", + " Return a list of the substrings in the string, using sep as the separator string.\n", + " \n", + " sep\n", + " The separator used to split the string.\n", + " \n", + " When set to None (the default value), will split on any whitespace\n", + " character (including \\\\n \\\\r \\\\t \\\\f and spaces) and will discard\n", + " empty strings from the result.\n", + " maxsplit\n", + " Maximum number of splits (starting from the left).\n", + " -1 (the default value) means no limit.\n", + " \n", + " Note, str.split() is mainly useful for data that has been intentionally\n", + " delimited. With natural text that includes punctuation, consider using\n", + " the regular expression module.\n", + "\n" + ] + } + ], + "source": [ + "help(course.split)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "76u3sCogxnVV", + "outputId": "ae6bebb6-1986-4071-93b5-ea166f799230" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Help on built-in function join:\n", + "\n", + "join(iterable, /) method of builtins.str instance\n", + " Concatenate any number of strings.\n", + " \n", + " The string whose method is called is inserted in between each given string.\n", + " The result is returned as a new string.\n", + " \n", + " Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'\n", + "\n" + ] + } + ], + "source": [ + "help(course.join)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "CfS8t3kbyJZt", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "9a46b470-4c20-41c8-e260-24fdb51f982b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Python-Programming'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 75 + } + ], + "source": [ + "'-'.join(course.split())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9xq3jrsO99g9" + }, + "source": [ + "
\n", + "\n", + "---\n", + "\n", + "
\n", + "\n", + "# Appendix: Operator Precedence\n", + "\n", + "Python evaluates expressions from left to right. The following table summarizes the *operator precedence* for all the operators we have seen so far, from highest precedence to lowest precedence:\n", + "\n", + "\n", + "\n", + "|Operator|Meaning|\n", + "|:-- |:-- |\n", + "|`()`|Grouping|\n", + "|`x[i], x[i:j:k], x(...), x.attr`|Indexing, slicing, call, attribute reference|\n", + "|`**`|Exponentiation|\n", + "|`+x, -x`|identity, negatition|\n", + "|`*, /, //, %`|Multiplication (repetition), division, integer division, remainder (format)|\n", + "|`+, -`|Addition (concatenation), substraction|\n", + "|`<, <=, >, >=, ==, !=, in, not in, is, is not`|Comparisons, including membership tests and identity tests|\n", + "|`not`|Logical negation|\n", + "|`and`|Logical AND|\n", + "|`or`|Logical OR|" + ] + } + ], + "metadata": { + "colab": { + "provenance": [], + "toc_visible": true + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.13" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/course_materials/Topic_2_Data_Structures_(with answers).ipynb b/course_materials/Topic_2_Data_Structures_(with answers).ipynb new file mode 100644 index 0000000..bf5ff49 --- /dev/null +++ b/course_materials/Topic_2_Data_Structures_(with answers).ipynb @@ -0,0 +1,6391 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "geOMOVqbWt5E" + }, + "source": [ + "\n", + "# Data Structures\n", + "\n", + "\n", + "Most of the data types we have encountered so far are **atomic types** (except strings). Atomic data types cannot be broken down into smaller components.\n", + "\n", + "\n", + "\n", + "In many applications, data is related in some way, and should be organized in some structure that mirrors the semantics of data:" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "cell_style": "split", + "id": "6T83x0VPhhFu" + }, + "source": [ + "- A shopping cart of items\n", + "\n", + "- A gradebook for a class\n", + "\n", + "- A person's demographic characteristics\n", + "\n", + "- Members of an online community\n", + "\n", + "- Districts of Hong Kong\n", + "\n", + "- Pixels of an image\n", + "\n", + "……\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "cell_style": "split", + "id": "NqZiuIKLhhFv" + }, + "source": [ + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_5wCvr4bhhFw" + }, + "source": [ + "In programming, we use **data structures** to pack related data together.\n", + "\n", + "In simple terms, a data structure refers to a **container** that organizes a **collection** of data in a particular structure.\n", + "\n", + "In Python, the four common data structures are:\n", + "\n", + "- Lists and tuples (sequential containers)\n", + "- Dictionaries (associative containers)\n", + "- Sets (set containers)\n", + "\n", + "Like numbers, strings, and Booleans, they are built-in data types in Python.\n", + "\n", + "
\n", + "\n", + "\n", + "> In programming, it is important to understand what questions we are trying to ask of our data and pick a data structure that can answer these questions quickly." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WB8fjyIFsmkJ" + }, + "source": [ + "\n", + "
\n", + "\n", + "# 1 Lists and Tuples\n", + "\n", + "Both lists and tuples are data structures containing a **sequence** (an **ordered collection**) of objects (of any type), and can be created with a construct known as a **list**/**tuple display**:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "vWIrm62usmkK", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a8ee3377-7a0a-4214-a2f2-be0d92e78ebe" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'orange', 'banana', 'mango']" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']\n", + "fruits" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "x1VQ5fhahhFz", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1f693ec7-5c1f-44e4-c852-a55077100bda" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "list" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "type(fruits)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "ehC3qi82smkR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "56d17648-3f3f-4703-8b6a-fe2fcfc8846f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 4, 9, 16, 25)" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "squares = (1, 4, 9, 16, 25) # Paratheses can be dropped; squares = 1, 4, 9, 16, 25\n", + "squares" + ] + }, + { + "cell_type": "code", + "source": [ + "squares = 1, 4, 9, 16, 25\n", + "squares" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_9mGNMmaxZ4V", + "outputId": "cc644eb3-5f09-48d8-8514-fe41aad31bc3" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 4, 9, 16, 25)" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "qN4-FpWGsmkZ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7fab3b47-32fa-4931-c54b-953e32fd8674" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "tuple" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ], + "source": [ + "type(squares)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "To create a tuple with only one item, you need to add a comma after the item, otherwise Python will not recognize the variable as a tuple." + ], + "metadata": { + "id": "L_Y5J4mwgJcO" + } + }, + { + "cell_type": "code", + "source": [ + "height = (175,)\n", + "height" + ], + "metadata": { + "id": "td7hBe8NgLeb", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ad98efbe-f83d-4a28-ba52-200b796c46fb" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(175,)" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "cell_type": "code", + "source": [ + "height = (175)\n", + "height" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "I8bNA4bixnTe", + "outputId": "d792a3ff-61af-4a7a-da78-a40869f0a643" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "175" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "3dtDT246smkd" + }, + "source": [ + "The physical content of a list or a tuple consists of **object references** (i.e., the address of the memory location where the object is allocated) rather than actual objects:\n", + "\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QFrNiiiesmkf" + }, + "source": [ + "The elements of a list or a tuple can be of varying types:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Hn1NS5YOsmkf" + }, + "outputs": [], + "source": [ + "mixed_list = ['Mike', 1.83, True]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "29MXB2h-hhGA" + }, + "outputs": [], + "source": [ + "mixed_tuple = ('spam', 2, False)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "YTWf6R8psmkj" + }, + "source": [ + "Both lists and tuples are ***nestable***:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Cpll5RPWWt5L", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6f3c99aa-3899-47d1-a484-8978483b7d07" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[['apple', 'orange', 'banana', 'mango'], [2.0, True]]" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "nested_list = [fruits, [2.0, True]]\n", + "nested_list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "TGK2YcWeWt5M", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b2f0e954-bf55-4a27-bba4-6ed57b4e2da7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "((1, 4, 9, 16, 25), ('spam', 9), True)" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "nested_tuple = squares, ('spam', 9), True\n", + "nested_tuple" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "z0H3Uk7Ysmkq" + }, + "source": [ + "\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* create a nested list/tuple which contains the information about a particular student, for example, the first element is his/her name, the second element is a sub-list/sub-tuple that contain his/her grades on math and english." + ], + "metadata": { + "id": "tx8_oGh5cHAg" + } + }, + { + "cell_type": "code", + "source": [ + "#write your codes here\n", + "['Charles',[90, 70]]" + ], + "metadata": { + "id": "Ib17mT1ycKDX", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f4111756-bdda-47f4-df20-cebb8ccd7791" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Charles', [90, 70]]" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "('Jane',(100, 95))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "MZIesejNzEdB", + "outputId": "3e5434ce-5b84-4405-d933-4b5d048661b3" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('Jane', (100, 95))" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ze1Ovz_lsmk1" + }, + "source": [ + "
\n", + "\n", + "## 1.1 Indexing\n", + "\n", + "\n", + "As a sequence maintains a left-to-right order among its elements, the elements can be indexed by **integers** (representing positions in the sequence) and individually accessed by using the indexing operator (`[]` that encloses an integer). The elements of a list or a tuple can be indexed positionally in the same way as the characters in a string.\n", + "\n", + "Python supports both positive indexing and negative indexing.\n", + "\n", + "The set for positive indexing contains the integers $0, 1, \\dots,$ and $n-1$ (**0-based indexing**), while that for negative indexing contains the integers $-1, -2, \\dots,$ and $-n$.\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "vcqYdEwtsmk2" + }, + "outputs": [], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "57whCZP5Wt5N", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "9a811a3a-0cd6-458a-8347-19cb1ff877de" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'banana'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 16 + } + ], + "source": [ + "fruits[2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Za2gVr3cXSPW", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "ee02c87c-eced-4f47-c47e-792221c1a8f3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'orange'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "fruits[-3]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "H79kQ1Hqsmk-" + }, + "outputs": [], + "source": [ + "squares = (1, 4, 9, 16, 25)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Fs2b6g-TWt5O", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "59934400-5f1a-478e-ee39-cb01dbcf8e13" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "16" + ] + }, + "metadata": {}, + "execution_count": 19 + } + ], + "source": [ + "squares[3]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "5YxTouUcWt5O", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3916a95a-ffdc-493b-fbec-dd3e517b29fd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "25" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ], + "source": [ + "squares[-1]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "csWHd3_vsmlS" + }, + "source": [ + "Accessing items in a subsequence can be done by simply appending additional indicies:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "WraxiKVHsmlS" + }, + "outputs": [], + "source": [ + "nested_list = [['apple', 'orange', 'banana', 'mango'], [2.0, True]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "al9lEobGWt5P", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fcda206e-d5bb-49a5-ded5-13d288a3f652" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'orange', 'banana', 'mango']" + ] + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "nested_list[-2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "uuT843uoWt5P", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "9165c518-ac38-4ada-bc8c-6cddc72a6649" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'apple'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 23 + } + ], + "source": [ + "nested_list[-2][0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "8Smo4Fx0smlb" + }, + "outputs": [], + "source": [ + "nested_tuple = (1, 4, 9, 16, 25), ('spam', 9), True" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "S7HCbbqPWt5Q", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "3618d4a4-c74d-4152-cf03-6e9634dc0eed" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'spam'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 25 + } + ], + "source": [ + "nested_tuple[1][-2]" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise*: Write code to access `'m'` from `nested_tuple`" + ], + "metadata": { + "id": "R3om_Fu0G9uV" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "XB90fz1TWt5Q", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "d91c5cec-88f3-4004-880e-40ceb12dd070" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'m'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "# Write your code here\n", + "nested_tuple[1][-2][-1]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "aoY4Si2gsmlr" + }, + "source": [ + "** Question**: What will be the result of `fruits[-2][3]`?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "fHbJ2u6jY6uT" + }, + "outputs": [], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "RxaOnTyyaD7E", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "2f03e1ee-42a8-448e-8708-c65be9b10f51" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'a'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 28 + } + ], + "source": [ + "fruits[-2][3]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "rZYCQRNfsmlx" + }, + "source": [ + "
\n", + "\n", + "## 1.2 Slicing\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "Indexing is limited to accessing one element at a time.\n", + "\n", + "**Slicing**, on the other hand, can extract a **segment** of a sequence (called a **slice**).\n", + "\n", + "The slice operator also works with lists and tuples as it does with strings. The slicing operator `[i:j]` returns the part of the list from the element indexed by `i` to the element indexed by `j`, ***including the first but excluding the last***:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "spsID6vvWt5S" + }, + "outputs": [], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "YPn1zK2RhhGq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0b161dc7-6dc7-4cab-f39e-0265c97f8a4b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['orange']" + ] + }, + "metadata": {}, + "execution_count": 30 + } + ], + "source": [ + "# still return a list\n", + "fruits[1:2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "NE-rbMS7Wt5T" + }, + "outputs": [], + "source": [ + "squares = 1, 4, 9, 16, 25" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "nX8Fw3Q-sml6", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ba8919be-13a3-4c9a-aeba-0dbfd61aeb93" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(9,)" + ] + }, + "metadata": {}, + "execution_count": 32 + } + ], + "source": [ + "# still return a sequence\n", + "squares[-3:-2]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "R6QhmUnlb2jL" + }, + "source": [ + "In slicing, either or both of the two indexes can be dropped. If the 1st index is omitted, the slice starts at the beginning of the list; if the 2nd index is omitted, the slice goes to the end of the list:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "B4E-L_eusml1", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "09ba70b1-3f48-4040-dd16-308ba061bddc" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'orange']" + ] + }, + "metadata": {}, + "execution_count": 33 + } + ], + "source": [ + "fruits[:2] # The slice starts at the beginning" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Mi5dWDvRY6uV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1a2102ae-4311-4083-a832-602f814de855" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['banana', 'mango']" + ] + }, + "metadata": {}, + "execution_count": 34 + } + ], + "source": [ + "fruits[2:] # The slice goes to the end" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "k9YODAiysml9", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f14b45ac-193a-4a81-cc52-959da1e61ec9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 4, 9, 16, 25)" + ] + }, + "metadata": {}, + "execution_count": 35 + } + ], + "source": [ + "squares[:] # The slice starts at the beginning and goes to the end" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "TZhnqGj7smmB" + }, + "source": [ + "
\n", + "\n", + "## 1.3 Working with Operators and Built-in functions\n", + "\n", + "Several Python operators and built-in functions can also be used with lists and tuples (in ways analogous to strings):\n", + "\n", + "- The `+` operator concatenates lists or tuples, while the `*` operator repeats a list or a tuple a given number of times:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "hc8xrHnfsmmC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7629830b-243a-4e51-ed22-927a73af2194" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'orange', 'banana', 'mango', True]" + ] + }, + "metadata": {}, + "execution_count": 36 + } + ], + "source": [ + "fruits + [True]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "FFtynsAqsmmD", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "226c5070-cc59-4554-a7b4-9286c933e751" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 4, 9, 16, 25, 30, False)" + ] + }, + "metadata": {}, + "execution_count": 37 + } + ], + "source": [ + "squares + (30, False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "32rTfa49smmF", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "545ebd64-1cd1-430b-92ec-2253cc10ea52" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 2, 3, 1, 2, 3, 1, 2, 3]" + ] + }, + "metadata": {}, + "execution_count": 38 + } + ], + "source": [ + "[1, 2, 3] * 3" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "AHXuQLBzsmmH", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "91e5cea7-8075-445d-baf7-b4a99ea9bcdc" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('spam', 2, True, 'spam', 2, True)" + ] + }, + "metadata": {}, + "execution_count": 39 + } + ], + "source": [ + "('spam', 2, True) * 2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yLZuU-PSsmmJ" + }, + "source": [ + "- The operators `in` and `not in` do membership tests and return `True` or `False`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "BQePVG6EsmmL", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "947112e6-eba8-406d-d288-ba8ae167ee97" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 40 + } + ], + "source": [ + "30 not in fruits" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "btHhs599smmM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c4d93a5b-2d5d-423e-92f7-b9185001ceec" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 41 + } + ], + "source": [ + "'spa' in ('spam', 2, True) # 'spam' is a member of ('spam', 2, True) but not 'spa'" + ] + }, + { + "cell_type": "code", + "source": [ + "'spam' in ('spam', 2, True)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "4mB-lu5l3lIm", + "outputId": "1b2f9006-2283-4a1c-db2f-811b8034c991" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 42 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "3Qg617cLsmmO" + }, + "source": [ + "- These two sequence types also support comparisons (using `<`, `>`, `==`, `>=`, `<=`, and `!=`). In particular, lists and tuples are compared lexicographically using comparison of corresponding elements:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Y9OrMvtesmmP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f4f571ea-fba6-4694-9a10-e332fafd9f65" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 43 + } + ], + "source": [ + "['Mike', 1.83, True] <= ['Mike', 1.80, False]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "2X1sJUDfsmmS", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d8497118-ac6c-49c3-fcbe-c50ccf72a7d0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 44 + } + ], + "source": [ + "('spam', 2, False) <= ('spam', 2, True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "fYIDLf5FsmmV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "56cc0d10-90a6-44d0-ec85-4eb7d29580cd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 45 + } + ], + "source": [ + "['Mike', 1.83, True] <= ['Mike', 1.80]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Imh00eHcsmmY", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "99acfc54-33ad-49d2-e290-95fc07132863" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'<=' not supported between instances of 'int' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m(\u001b[0m\u001b[0;34m'spam'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m'spam'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# cannot compare between different types\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: '<=' not supported between instances of 'int' and 'str'" + ] + } + ], + "source": [ + "('spam', 2, False) <= ('spam', '2', True) # cannot compare between different types" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Predict which is larger, ['large',10, 'big'] or ['small',1, 'little'] ? Write codes to verify your prediction.\n", + "\n", + "How can you re-arrange the items in the list so that the result would change?" + ], + "metadata": { + "id": "w4ssOkWKilkf" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "['large',10, 'big'] < ['small',1, 'little']" + ], + "metadata": { + "id": "Prqa1lePixpH", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6f433318-d052-4342-9b64-536421dcb953" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 47 + } + ] + }, + { + "cell_type": "code", + "source": [ + "[10,'large', 'big'] < [1,'small', 'little']" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "a7Yvzqg54gJz", + "outputId": "7af7c6f2-d3c2-4f63-9cf0-1409abeb0427" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 48 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ljaSPUeFsmmp" + }, + "source": [ + "\n", + "\n", + "- [`len()`](https://docs.python.org/3/library/functions.html#len) returns the number of elements in a list or a tuple:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "COjAprS7smmq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c7f0db8f-19cc-41ea-c687-1373e63e0275" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "4" + ] + }, + "metadata": {}, + "execution_count": 49 + } + ], + "source": [ + "len(fruits)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "rBXAHpsfsmmt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9e8e5c2f-e960-4d36-a019-b12972b96ad6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 50 + } + ], + "source": [ + "len(squares)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "oHxGJ5HFRWEn", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1501de35-465f-4c8e-f982-19ff4246121c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[['apple', 'orange', 'banana', 'mango'], [2.0, True]]" + ] + }, + "metadata": {}, + "execution_count": 51 + } + ], + "source": [ + "nested_list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "H7zrNw9fRWEp", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c33a7e14-c197-41b3-c2c4-ada47c5c7af7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "((1, 4, 9, 16, 25), ('spam', 9), True)" + ] + }, + "metadata": {}, + "execution_count": 53 + } + ], + "source": [ + "nested_tuple" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "l4kuDQzqWt5a", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b6ec9831-e012-470f-89ff-8cd753e12ae9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "2" + ] + }, + "metadata": {}, + "execution_count": 52 + } + ], + "source": [ + "len(nested_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "rrztaT6kWt5b", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "bffea2e6-19b4-4582-a176-07a6e27a692c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "execution_count": 54 + } + ], + "source": [ + "len(nested_tuple)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_r8H9gbmsmmx" + }, + "source": [ + "- [`max()`](https://docs.python.org/3/library/functions.html#max) ([`min()`](https://docs.python.org/3/library/functions.html#min)) returns the largest (smallest) element. Can work with elements of comparable types:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "JKqf-UzZsmmy", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "b8253e35-d628-4cb5-fab2-ac3a5b293916" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'orange'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 55 + } + ], + "source": [ + "max(fruits) # based on lexicographic order" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "T83bKfwAsmm0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d3f24599-c888-4801-a666-ca44939fef6b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1" + ] + }, + "metadata": {}, + "execution_count": 56 + } + ], + "source": [ + "min(squares)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jmxohMk5Wt5d", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "6a594ae0-41ea-4c1f-8a9f-25a4011d8fe4" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'>' not supported between instances of 'bool' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'spam'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: '>' not supported between instances of 'bool' and 'str'" + ] + } + ], + "source": [ + "max(('spam', '2', True))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "1eKJ2S9Tsmm2" + }, + "source": [ + "- [`sum()`](https://docs.python.org/3/library/functions.html#sum) returns the sum of all elements in a sequence. Can only work with numeric elements:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Ib2WG_0qsmm2", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "84f82764-8cae-4cc9-8f95-907697a90777" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "55" + ] + }, + "metadata": {}, + "execution_count": 58 + } + ], + "source": [ + "sum(squares)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "7TL7PE1esmm4", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "aa81d95c-9293-4aac-ec72-0812a4c2b9af" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unsupported operand type(s) for +: 'int' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfruits\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'int' and 'str'" + ] + } + ], + "source": [ + "sum(fruits)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* I have a list of student grades [90, 80, 75, 88, 67].Try to find the average grade of all students in the student grades list/tuple by using sum() and len()" + ], + "metadata": { + "id": "N2saKdyMkMxP" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "sum([90, 80, 75, 88, 67])/len( [90, 80, 75, 88, 67])" + ], + "metadata": { + "id": "KsnLBNZ0kLtY", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "189be95c-9218-465e-fa11-3fc5a0bd3994" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "80.0" + ] + }, + "metadata": {}, + "execution_count": 60 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0OAW-rrpsmnA" + }, + "source": [ + "
\n", + "\n", + "## 1.4 Common List and Tuple Methods\n", + "\n", + "- `s.index(x[, i[, j]])` returns index of the first occurrence of `x` in `s` (at or after index `i` and before index `j`):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Gp60RjjpsmnB", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c83e2e49-4da4-404b-a623-653a0c10e98f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Mike', 1.83, True, 'Mike', 1.83, True]" + ] + }, + "metadata": {}, + "execution_count": 61 + } + ], + "source": [ + "repeated_list = ['Mike', 1.83, True] * 2\n", + "repeated_list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "KDAWbqFGsmnD", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dc25b6b3-5884-4db5-bd64-fd6a393f6a54" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('spam', 2, True, 'spam', 2, True, 'spam', 2, True)" + ] + }, + "metadata": {}, + "execution_count": 62 + } + ], + "source": [ + "repeated_tuple = ('spam', 2, True) * 3\n", + "repeated_tuple" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "EnufXB0iY6uf", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1be52fb3-5340-4663-fe34-48fab445dd94" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "2" + ] + }, + "metadata": {}, + "execution_count": 63 + } + ], + "source": [ + "repeated_list.index(True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "AMSdOJjdsmnC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4b07d455-5896-468d-dda5-37f9dc4e9bc9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 64 + } + ], + "source": [ + "repeated_list.index(True, 3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "dHso_HLZsmnE", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2986375b-d59c-406c-99f4-5675aa593c05" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "execution_count": 65 + } + ], + "source": [ + "repeated_tuple.index('spam', 1, 4)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5x8cgt8lsmnH" + }, + "source": [ + "- `s.count(x)` returns the total number of occurrences of `x` in `s`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Mcz91bqtsmnH", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "46343732-f45b-461a-ebcf-78e4462b58b6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "2" + ] + }, + "metadata": {}, + "execution_count": 66 + } + ], + "source": [ + "repeated_list.count(True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "ucU9eHnPlV2K", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7c42815c-7f13-49b5-fd84-b48c341b1c56" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "execution_count": 67 + } + ], + "source": [ + "repeated_tuple.count('spam')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IENczqRvsmnM" + }, + "source": [ + "- Use `dir()` to display all the names accessible to a list or a tuple:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "ncU4VkdUsmnO", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a27e5c6a-8ca9-4126-b05f-50365bb1a100" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['__add__',\n", + " '__class__',\n", + " '__class_getitem__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__delitem__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__iadd__',\n", + " '__imul__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__mul__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__reversed__',\n", + " '__rmul__',\n", + " '__setattr__',\n", + " '__setitem__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " 'append',\n", + " 'clear',\n", + " 'copy',\n", + " 'count',\n", + " 'extend',\n", + " 'index',\n", + " 'insert',\n", + " 'pop',\n", + " 'remove',\n", + " 'reverse',\n", + " 'sort']" + ] + }, + "metadata": {}, + "execution_count": 68 + } + ], + "source": [ + "dir(repeated_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "gqBPp6GrsmnQ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ab6e320b-c02d-4bbe-b8c6-0dad164577e4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['__add__',\n", + " '__class__',\n", + " '__class_getitem__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__getnewargs__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__mul__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__rmul__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " 'count',\n", + " 'index']" + ] + }, + "metadata": {}, + "execution_count": 69 + } + ], + "source": [ + "dir(repeated_tuple)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0EL2_EU3smnS" + }, + "source": [ + "
\n", + "\n", + "## 1.5 Lists are Mutable\n", + "\n", + "Once a list is created, elements can be added, deleted, shifted, and moved around at will.\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "f6Znvo_0sBsi" + }, + "source": [ + "\n", + "### 1.5.1 Item Assignment\n", + "\n", + "\n", + "We can use indexing on the left side of an assignment to identify the element to be modified:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "2RPSofPXsmnS" + }, + "outputs": [], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']\n", + "fruits" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "8RtdapZTsmnU", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b7041d6e-9054-4399-b174-c811fe2caf41" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'melon', 'banana', 'mango']" + ] + }, + "metadata": {}, + "execution_count": 70 + } + ], + "source": [ + "fruits[1] = 'melon' # item assignment\n", + "fruits" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "v7YAXktSsmnX" + }, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Qc687JeHsmnv" + }, + "source": [ + "### 1.5.2 Deleting List Elements\n", + "\n", + "List elements can be deleted with [the `del` statement](https://docs.python.org/3/reference/simple_stmts.html#del):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "LNrXQbj5smnw" + }, + "outputs": [], + "source": [ + "del fruits[2:]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "8Xjzu9GDRWFt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "26f4f10e-a758-424f-cde5-21361fa6df7d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'melon']" + ] + }, + "metadata": {}, + "execution_count": 72 + } + ], + "source": [ + "fruits" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dZX29V-J07JM" + }, + "source": [ + "\n", + "### 1.5.3 Methods That Modify a List\n", + "\n", + "Python provides several built-in methods that can be used to modify lists:" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "fRzTKJzjsmoe" + }, + "source": [ + "- [`sort(key=None, reverse=False)`](https://docs.python.org/3/library/stdtypes.html#list.sort) sorts the list in ascending order ***in place*** (i.e., modifies the original list directly):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "grBplHk-smoe" + }, + "outputs": [], + "source": [ + "fruits = ['apple', 'orange', 'banana', 'mango']\n", + "fruits.sort()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XXC4eDOysmog", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "55d25235-e1e3-4e6f-b401-924975009ea7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'banana', 'mango', 'orange']" + ] + }, + "metadata": {}, + "execution_count": 74 + } + ], + "source": [ + "fruits" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Dp8XqRW_smol" + }, + "source": [ + "If `reverse` is set to `True`, the list elements are sorted as if each comparison were reversed:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "-8_MZ7lEsmom", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d88397aa-1ae3-4b11-a771-6c55199d4436" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['orange', 'mango', 'banana', 'apple']" + ] + }, + "metadata": {}, + "execution_count": 75 + } + ], + "source": [ + "fruits.sort(reverse=True)\n", + "fruits" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "cxAGtfr-Wt59" + }, + "source": [ + "If any comparison fails, the entire sort will fail:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "MiF8LGT2smoh", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "outputId": "6dcebcc6-af98-431c-d622-9e0b613660bb" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'<' not supported between instances of 'int' and 'str'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0memployee\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'Charles'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Business Analyst'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m9\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0memployee\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: '<' not supported between instances of 'int' and 'str'" + ] + } + ], + "source": [ + "employee = ['Charles', 'Business Analyst', 9, True]\n", + "employee.sort()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6v_1z0uVsmon" + }, + "source": [ + "We can change the rule for comparison by specifying the comparison `key`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "zZFXYRRwY6ul", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "75b7585c-36f0-472c-d7f5-5c501ac436ed" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Charles', 'Business Analyst', 9, True]" + ] + }, + "metadata": {}, + "execution_count": 77 + } + ], + "source": [ + "employee" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "OL2GlFA-smon", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "83620b0f-2720-4c47-df85-957ecc8b7311" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[9, 'Business Analyst', 'Charles', True]" + ] + }, + "metadata": {}, + "execution_count": 80 + } + ], + "source": [ + "employee.sort(key=str) #sort values of varying types as if they were all strings\n", + "employee" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "g2n4fU68smop" + }, + "source": [ + "`key` specifies the name of a ***1-argument*** function (`len`, `str`, `max`, etc.) to use to extract a comparison `key` from each element.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "khtn1Pw4Wt5-", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6fb7bc12-d43f-4bdd-fcf8-b7ba7e08cf72" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['c', 'ee', 'ddd', 'bbbb', 'aaaaa']" + ] + }, + "metadata": {}, + "execution_count": 81 + } + ], + "source": [ + "repeated_letters = ['aaaaa', 'bbbb', 'c', 'ddd', 'ee']\n", + "repeated_letters.sort(key=len)\n", + "repeated_letters" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* we have a list consisting of string numbers\n", + "```python\n", + "string_numbers=['0','5','10','2','8']\n", + "```\n", + "Sort this list according to the numeric values represented by these string numbers." + ], + "metadata": { + "id": "rucjyNSZr2_u" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "string_numbers=['0','5','10','2','8']\n", + "string_numbers.sort(key=int)\n", + "string_numbers" + ], + "metadata": { + "id": "9_ra-Ti3r7zo", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7c889be6-a953-4b2d-ede8-c83b5dcf43a8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['0', '2', '5', '8', '10']" + ] + }, + "metadata": {}, + "execution_count": 82 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Sort the following numbers by absolute value in descending order:\n", + "\n", + "```python\n", + "numbers=[0.12, 0.78, 0.5, -0.43, -0.87, 1.0, 0.64]\n", + "```" + ], + "metadata": { + "id": "ODAhpqZkg9mf" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "numbers=[0.12, 0.78, 0.5, -0.43, -0.87, 1.0, 0.64]\n", + "numbers.sort(key=abs, reverse=True)\n", + "numbers" + ], + "metadata": { + "id": "PpKFkyqEhTSj", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f4152ec8-2f97-4152-d5c5-765937e33a4b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1.0, -0.87, 0.78, 0.64, 0.5, -0.43, 0.12]" + ] + }, + "metadata": {}, + "execution_count": 83 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QjJGui-tWt6A" + }, + "source": [ + "There is a built-in function, `sorted()`, that does the same thing but returns a new sorted list rather than modifying the original one in place:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XCto7bMnsmop", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "733c45c6-f7f1-446b-cc54-ceb31c7f841c" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Help on built-in function sorted in module builtins:\n", + "\n", + "sorted(iterable, /, *, key=None, reverse=False)\n", + " Return a new list containing all items from the iterable in ascending order.\n", + " \n", + " A custom key function can be supplied to customize the sort order, and the\n", + " reverse flag can be set to request the result in descending order.\n", + "\n" + ] + } + ], + "source": [ + "help(sorted)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "pm1oU8lFsmox", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "706682d7-08cc-4685-bef1-a6d07de8018d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['apple', 'banana', 'mango', 'orange']" + ] + }, + "metadata": {}, + "execution_count": 85 + } + ], + "source": [ + "sorted(fruits) # note that this would not modify the original list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "U4hP1LzrWt6B", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b0188418-3d36-4472-b7c0-688744536f0f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['orange', 'mango', 'banana', 'apple']" + ] + }, + "metadata": {}, + "execution_count": 86 + } + ], + "source": [ + "fruits" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Two words are anagrams if you can rearrange the letters from one to spell the other. For example, \"fried\" and \"fired\" are anagrams (similarly, \"race\" and \"care\").\n", + "\n", + "Given two arbitrary strings, write codes to decide whether these two strings are anagrams." + ], + "metadata": { + "id": "N7e1NT25yroq" + } + }, + { + "cell_type": "code", + "source": [ + "#write your codes here\n", + "s1 = \"race\"\n", + "s2 = \"care\"\n", + "sorted(s1) == sorted(s2)" + ], + "metadata": { + "id": "jKNFLU3yyv4X", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e96e18a0-658b-4c8d-9d03-026407919043" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 89 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "- `insert(index, object)` takes an element and insert it at a particular index. The return value is `None` (this applies to all following methods unless explicitly mentioned):" + ], + "metadata": { + "id": "mkfrB0D4tyTS" + } + }, + { + "cell_type": "code", + "source": [ + "fruits = ['peach', 'melon']" + ], + "metadata": { + "id": "JoKGiV0It1Pp" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "fruits.insert(2, 'peach')" + ], + "metadata": { + "id": "-3jNSSNOt24t" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "fruits" + ], + "metadata": { + "id": "siD4I17ft7Z3", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e9dbf8b6-dfed-45e4-9e7a-eb1fa0f3b621" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['peach', 'melon', 'peach']" + ] + }, + "metadata": {}, + "execution_count": 92 + } + ] + }, + { + "cell_type": "code", + "source": [ + "fruits.insert(2, ['olive', 'banana']); fruits" + ], + "metadata": { + "id": "B_arTjOpt9LR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9b3b806f-8e97-4005-da89-3d258432e6d2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['peach', 'melon', ['olive', 'banana'], 'peach']" + ] + }, + "metadata": {}, + "execution_count": 93 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "- `append(object)` takes an element and adds it to the end of a list:" + ], + "metadata": { + "id": "e4UH6yNIuO9Y" + } + }, + { + "cell_type": "code", + "source": [ + "fruits.append('plum'); fruits" + ], + "metadata": { + "id": "n2MgWRN3uhGk", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2a005051-8708-40fb-8526-65e0013bc6c7" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['peach', 'melon', ['olive', 'banana'], 'peach', 'plum']" + ] + }, + "metadata": {}, + "execution_count": 94 + } + ] + }, + { + "cell_type": "code", + "source": [ + "fruits.append(['litchi', 'banana']); fruits" + ], + "metadata": { + "id": "TPwHw0nguir8", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "12f5417f-e29a-4e99-f3c9-d74ed62ec6c6" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['peach', 'melon', ['olive', 'banana'], 'peach', 'plum', ['litchi', 'banana']]" + ] + }, + "metadata": {}, + "execution_count": 95 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Define a list `L1 = [\"bacon\", \"eggs\"]`.\n", + "\n", + "predict the output of the following codes\n", + "```python\n", + "L1.append(\"juice\")\n", + "or\n", + "L1+'juice'\n", + "or\n", + "L1+['juice']\n", + "or\n", + "L1.insert(2,'juice')\n", + "or\n", + "L1.insert(2,['juice'])\n", + "```" + ], + "metadata": { + "id": "5LqL_0uWushe" + } + }, + { + "cell_type": "code", + "source": [ + "L1 = [\"bacon\", \"eggs\"]\n", + "# write codes to verify your prediction here\n" + ], + "metadata": { + "id": "vWg8olLivCeU" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "pTMyUNaPsmny" + }, + "source": [ + "### 1.5.4 Tuples and Strings are Immutable" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "gABrejziWt5o", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "ed5d8f0a-e259-4abc-b090-5506b3397159" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'str' object does not support item assignment", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m'spam'\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'u'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" + ] + } + ], + "source": [ + "'spam'[2] = 'u'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "NJOSNasCsmny", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "17824074-0df5-43e6-f747-6132664db102" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "'tuple' object does not support item assignment", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msquares\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: 'tuple' object does not support item assignment" + ] + } + ], + "source": [ + "squares[2] = 3" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "FBxHg68gWt5t" + }, + "source": [ + "\n", + "## 1.6 Conversions\n", + "\n", + "We can convert between the different sequence types easily by using the type functions (e.g., `list()` and `tuple()`) to cast sequences to the desired types:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "JG8OCZoJsmpJ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6da99323-7ec3-4f37-a1c6-0163c42c6d60" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 4, 9, 16, 25]" + ] + }, + "metadata": {}, + "execution_count": 98 + } + ], + "source": [ + "list((1, 4, 9, 16, 25))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "vrngCHCQsmpK", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fd05d4cd-75af-472d-9aaa-fdfbbec47d33" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['s', 't', 'r', 'i', 'n', 'g']" + ] + }, + "metadata": {}, + "execution_count": 99 + } + ], + "source": [ + "list('string')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "3MCjdaRSsmpL", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ca393999-5401-4806-ead3-0257cc7b86a1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('apple', 'orange', 'banana', 'mango')" + ] + }, + "metadata": {}, + "execution_count": 100 + } + ], + "source": [ + "tuple(['apple', 'orange', 'banana', 'mango'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "rzYFzfK1smpM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "831e0650-42a6-4fe4-f175-1979027abf70" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('P', 'y', 't', 'h', 'o', 'n')" + ] + }, + "metadata": {}, + "execution_count": 101 + } + ], + "source": [ + "tuple('Python')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "iW6GH28LsmpN" + }, + "source": [ + "Type functions are actually constructors of objects of the corresponding types, and are also called factory functions. We will see this more clearly when we introduce classes.\n", + "\n", + "Calling a type function without an argument constructs an empty object of the corresponding type:" + ] + }, + { + "cell_type": "code", + "source": [ + "list()" + ], + "metadata": { + "id": "-YMD-AXzxz1A", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "5699ac54-aacb-4627-ee2f-4ea0d61dd405" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[]" + ] + }, + "metadata": {}, + "execution_count": 102 + } + ] + }, + { + "cell_type": "code", + "source": [ + "tuple()" + ], + "metadata": { + "id": "5tkqaC6Qx1Ym", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "088de9b3-ff3c-46c3-c113-7656c0afc7db" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "()" + ] + }, + "metadata": {}, + "execution_count": 103 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qpeu6kEVsmoy" + }, + "source": [ + "\n", + "## 1.7 Unpacking Sequences\n", + "\n", + "Python has a very powerful assignment feature, called **sequence unpacking**, that allows a sequence of variables on the left of an assignment to be assigned values from a sequence on the right of the assignment:\n", + "\n", + "Unpacking is especially useful to assign values from a list/tuple to several variables." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "sKaykWy6smoy" + }, + "outputs": [], + "source": [ + "student = 'Bob', 19, 'Finance'\n", + "name, age, study = student" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "f7I4-flusmoz", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "779fb33f-c6e6-4a06-9623-5e7af11ccbb5" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Bob'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 105 + } + ], + "source": [ + "name" + ] + }, + { + "cell_type": "code", + "source": [ + "age" + ], + "metadata": { + "id": "wjbPjbbBecBV", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dd4a124c-847d-4186-b73c-c077de83de1b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "19" + ] + }, + "metadata": {}, + "execution_count": 106 + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Xz8vK7Mesmo0", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "9a813e79-0316-4b17-ef53-12cf6b12cc11" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Finance'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 107 + } + ], + "source": [ + "study" + ] + }, + { + "cell_type": "code", + "source": [ + "name = student[0]\n", + "age = student[1]\n", + "study = student[2]" + ], + "metadata": { + "id": "pA1algubBM7_" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Iyi4djvYsmo6" + }, + "source": [ + "\n", + "This does the equivalent of several assignment statements, all on one easy line.\n", + "\n", + "Unpacking is also useful to swap the values of multiple variables:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XVuXGENPWt6D", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b8fa132e-c19b-45bb-e2c0-0c8c9330956b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(19, 'Finance', 'Bob')" + ] + }, + "metadata": {}, + "execution_count": 108 + } + ], + "source": [ + "age, study, name" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KcvYkvpJsmo6" + }, + "outputs": [], + "source": [ + "name, age, study = age, study, name" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "kiATR6YM3EK3", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e009f5e6-fba9-4b70-a275-de01d6883ca0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(19, 'Finance', 'Bob')" + ] + }, + "metadata": {}, + "execution_count": 110 + } + ], + "source": [ + "name, age, study" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "elLvgxrismo_" + }, + "source": [ + "Unpacking can be done ***deeply***:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "idhsHMA-smpA" + }, + "outputs": [], + "source": [ + "(color, (coord_x, coord_y, coord_z)) = ['red', [1.2, 2.0, 3.9]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jOiDNps-smpC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ae914443-700f-498b-bd6b-d0c6fcccdf77" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('red', 2.0)" + ] + }, + "metadata": {}, + "execution_count": 112 + } + ], + "source": [ + "color, coord_y" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Ex_-ZYf6Wt6F", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 36 + }, + "outputId": "1b7d7535-101b-4bd9-c89b-fdb874be1413" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'red'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 114 + } + ], + "source": [ + "color" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "m9b5XjvNWt6F", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a636e4a2-427d-4015-f62c-b5027b7ec275" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1.2" + ] + }, + "metadata": {}, + "execution_count": 115 + } + ], + "source": [ + "coord_x" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "EA1NXFOZsmo2" + }, + "source": [ + "\n", + "\n", + "When unpacking, the number of variables on the left must match the number of values in the sequence:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ncDxsDXIsmo4", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "d1e93c7d-7d7d-469c-a8a3-3f960e395090" + }, + "outputs": [ + { + "output_type": "error", + "ename": "ValueError", + "evalue": "too many values to unpack (expected 2)", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstudent\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: too many values to unpack (expected 2)" + ] + } + ], + "source": [ + "name, age = student" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "VCBeppbGsmpD" + }, + "source": [ + "\n", + "### The `*` Operator\n", + "\n", + "In Python, the `*` character is not only used for **multiplication** and **replication**, but also for unpacking/packing.\n", + "\n", + "- When used before a name on the left of an assignment, it creates a variable that gathers up any superfluous elements during sequence unpacking:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "IlhRHnposmpD" + }, + "outputs": [], + "source": [ + "numbers = (1, 2, 3, 4, 5)\n", + "first, *rest = numbers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "nqhd3R5qRWG_", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c09afa66-9a59-41bb-aad7-e2dd6b88c709" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "first" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "vkuiL8fDRWHC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "45652abd-834b-405c-d5c3-51c9a01990dd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[2, 3, 4, 5]" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ], + "source": [ + "rest" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "MKK6z4uGWt6H", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "060b172c-64fb-45b6-cd11-b443796b6830" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[2, 3, 4]" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "first, *middle, last = numbers\n", + "middle" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "DIFslb7ZsmpE", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "73685925-14cc-430e-fe04-857fa7b91c86" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('a', ['b'], 'c')" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "head, *body, tail = 'abc'\n", + "head, body, tail" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ksMYBWCHsmpG" + }, + "source": [ + "> The starred variable always ends up ***containing a list***.\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "**Question**: What does `first`, `remaining`, `others` hold after evaluating the following?\n", + "\n", + "```python\n", + "fruits = ['apple', 'orange', 'banana', 'mango']\n", + "((first, *remaining), *others) = fruits\n", + "```" + ], + "metadata": { + "id": "rJwY7896fPbp" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "8HA9Q1OQYyZx" + }, + "outputs": [], + "source": [ + "# write code here to verify\n", + "fruits = ['apple', 'orange', 'banana', 'mango']\n", + "((first, *remaining), *others) = fruits" + ] + }, + { + "cell_type": "code", + "source": [ + "first" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "LA1g1oiBO1BK", + "outputId": "58168afb-7bac-492a-fcce-aae07c43153b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'a'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "remaining" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "JdFunpXzO2mu", + "outputId": "afc3ea90-d625-4cde-e556-eaafdf692d0c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['p', 'p', 'l', 'e']" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ] + }, + { + "cell_type": "code", + "source": [ + "others" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "toJYVmELO4Mw", + "outputId": "10d4e470-db77-4571-8b23-8b0c26b51ec5" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['orange', 'banana', 'mango']" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "fV2RsdkNMgoy" + }, + "source": [ + "- When used before a sequence inside a list or tuple display, `*` unpacks its individual values:\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "km2mWBQVR3rS", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "66ea2816-8b02-438f-af37-34fc288e5988" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "([2, 3, 4, 5], 'a')" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "rest, first" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "CQq3XN2wRiCI", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2fef3576-7893-4a8f-de4d-d1a150ba0f64" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(2, 3, 4, 5, 'a')" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ], + "source": [ + "*rest, first" + ] + }, + { + "cell_type": "code", + "source": [ + "numbers" + ], + "metadata": { + "id": "TKfvEu9ex1jW", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e1f21ae9-d9f5-4ba5-fa5a-0150550283a4" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 2, 3, 4, 5)" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "code", + "source": [ + "body" + ], + "metadata": { + "id": "Q6tD8RL2x2if", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3e20f21f-12ff-4e31-cfd2-6ee0f1ed936d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['b']" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ] + }, + { + "cell_type": "code", + "source": [ + "[numbers, body]" + ], + "metadata": { + "id": "1cUTTYzJx4Kj", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1aaba1c2-e212-42a0-85c9-73a2830b23d0" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[(1, 2, 3, 4, 5), ['b']]" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ] + }, + { + "cell_type": "code", + "source": [ + "[*numbers, *body]" + ], + "metadata": { + "id": "3adKPxR1x7-C", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7cde5616-cb2b-4bb8-b3f3-f4d284f9b2be" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 'b']" + ] + }, + "metadata": {}, + "execution_count": 17 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "F19zAUc6lV4L" + }, + "source": [ + "\n", + "## 1.8 List Comprehensions\n", + "\n", + "List comprehension offers a **shorter syntax** when you want to create a new list based on the values of an existing list.\n", + "\n", + "As **expressions** that implement iteration protocol in Python, **comprehensions** allow a collection to be built from another collection by\n", + "\n", + "- iterating over the items in the source collection in turn;\n", + "- in each iteration, dispensing one item from the source collection and running the item (that passes the test specified by the predicate) through the output expression;\n", + "- and collecting all the results to form the new collection.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "reypB2y0lV4M" + }, + "outputs": [], + "source": [ + "a_list = [1, '4', 9, 'a', 4]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "aKB-hn9LWt6L", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "268065be-aaa4-491b-e800-5e26c812979e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 2 + } + ], + "source": [ + "isinstance(1, int) #isinstance() allows you to judge if a value's data type is int" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "BR9yhdSbRWHd", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6310add1-5760-4e1b-aaf5-44d73baa2f57" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 81, 16]" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "[e ** 2 for e in a_list if isinstance(e, int)]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Oqv-axMaRWHe" + }, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "source": [ + "> We will introduce how to use \"for\" keywords in details later." + ], + "metadata": { + "id": "TKrPUgT9qupw" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "ayE9FQjNRWHe", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8c9b2886-d6de-4ba0-a444-5967db125019" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[2, '44', 18, 'aa', 8]" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "[e * 2 for e in a_list]" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Use a list comprehension to create a new list called `slist` that contains the square of all odd numbers in `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]`." + ], + "metadata": { + "id": "GBv4obW93DAM" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "nlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "slist = [n ** 2 for n in nlist if n% 2 ==1]\n", + "slist" + ], + "metadata": { + "id": "NMskYDiz3CEx", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fe4b79f9-a7b3-4fba-9542-389074483177" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 9, 25, 49, 81]" + ] + }, + "metadata": {}, + "execution_count": 69 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "hVVD5_IshhJj" + }, + "source": [ + "Objects that are capable of returining its members one at a time (or over which we can iterate) is called **iterables**.\n", + "\n", + "\n", + "The input iterable can have nesting structures:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "fx4EQkZ3_8dW", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0e554c99-c6e3-4bef-a733-f9a8b2178783" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[95, 92, 89, 100, 59]" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ], + "source": [ + "gradebook = [['Alice', 95], ['Troy', 92], ['James', 89], ['Charles', 100], ['Bryn', 59]]\n", + "score_only = [pair[1] for pair in gradebook]\n", + "score_only" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "8WCmC0LzlV4P" + }, + "source": [ + "\n", + "\n", + "\n", + "The assignment of each item to the **loop variable** can leverage sequence unpacking to make the handling of nested data easier:\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "fpikH322Y46U", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "55632860-3980-4815-902d-c7e185fccd95" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Alice', 'Troy', 'James', 'Charles', 'Bryn']" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ], + "source": [ + "gradebook = [['Alice', 95], ['Troy', 92], ['James', 89], ['Charles', 100], ['Bryn', 59]]\n", + "name_only = [name for name, score in gradebook]\n", + "name_only" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ERs8VdXUlV4Q", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f33b479b-fc8b-407c-9d17-ee525a522581" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "87.0" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "# Calculate the average score\n", + "sum([score for name, score in gradebook])/len(gradebook)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "-FKTmVUQlV4T", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7e8918ff-0d2c-48b2-efa8-fc9a1ab35577" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "4" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "# Find how many students earned scores above 80\n", + "len([score for name, score in gradebook if score > 80])" + ] + }, + { + "cell_type": "markdown", + "source": [ + "**In-Class exercise:** Follow the logic, get average score of students whose score are below 90\n", + "\n", + "Hint:\n", + "1. find all students whose score are below 90\n", + "2. get the sum of their scores\n", + "3. get the number of such students" + ], + "metadata": { + "id": "c5lJ2QvK4jbh" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "sum([score for name, score in gradebook if score < 90])/len([score for name, score in gradebook if score < 90])" + ], + "metadata": { + "id": "jVrSkzsx4k_V", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "15fc55d7-3a0e-41cf-97af-733ef80eedc2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "74.0" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "markdown", + "source": [], + "metadata": { + "id": "nKuC7gkL52T_" + } + }, + { + "cell_type": "markdown", + "metadata": { + "id": "wyBuwQWnlV4U" + }, + "source": [ + "Comprehensions also work with other collections (e.g., **dictionaries**, **sets**, etc.) as we will see." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "YgHyLb35smpR" + }, + "source": [ + "
\n", + "\n", + "# 2 Dictionaries\n", + "\n", + "\n", + "| Name | Income | Years | Criminal |\n", + "|-----|-----|-----|-----|\n", + "| Amy | 27 |4.2 | No | \n", + "| Sam | 32 |1.5 | No |\n", + "| ... |\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ZnAPkqMlWt6R" + }, + "outputs": [], + "source": [ + "customer_1 = ['Amy', 27, 4.2, 'No']\n", + "customer_2 = ['Sam', 32, 1.5, 'No']" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qgp3SIJZWt6R" + }, + "source": [ + "How can a programmer know how to obtain a person's income without knowing too much about the context/data?\n", + "\n", + "But why not attach labels to individual items to reflect the meaning of our data:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "F1fjEmxGWt6R" + }, + "outputs": [], + "source": [ + "customer_1 = {'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}\n", + "customer_2 = {'name': 'Sam', 'income': 32, 'years': 1.5, 'criminal': 'No'}" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Zltbs4GSWt6R" + }, + "source": [ + "It leads to a new data structure supported by Python, called **dictionaries**.\n", + "\n", + "A dictionary is a container that maps a set of labels called **keys** to a set of values. The dictionary is the first **compound type** that we've seen that is **not a sequence type**.\n", + "\n", + "The association of a key and a value is called a **key-value pair**, and a dictionary can be defined by using the `{key: value}` syntax:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XEASBFL2smpR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dcaa5d46-0b5f-43af-fb0b-d22445f79b27" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 90, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ], + "source": [ + "gradebook = {'Alice': 95, 'Troy': 90, 'James': 89}\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "oIBhNHCHsmpS", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fb984a4c-4fab-493d-e3da-69f67fbc9160" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ], + "source": [ + "type(gradebook)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "We can also create an empty dict by using d=dict()" + ], + "metadata": { + "id": "nYq63ynk5tRJ" + } + }, + { + "cell_type": "code", + "source": [ + "newdict = dict()\n", + "type(newdict)" + ], + "metadata": { + "id": "cmCvv8WS5vTR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "67affdd8-7461-40d5-b4d1-69c6b18cfc54" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict" + ] + }, + "metadata": {}, + "execution_count": 16 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ZTL_-UVVsmpT" + }, + "source": [ + "Dictionary keys are ***unique*** and can be any ***immutable*** data type (e.g., numbers, strings, Booleans, tuples containing only immutable elements):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XO-Iy4KwsmpU", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1a8eef73-38e2-4303-d2c3-ec9e353f5b58" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'one', 2: 'dos', 3: 'tres'}" + ] + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "spnum = {1: 'uno', 2: 'dos', 3: 'tres', 1: 'one'}\n", + "spnum" + ] + }, + { + "cell_type": "code", + "source": [ + "{[1]: 'uno', 2: 'dos', 3: 'tres'}" + ], + "metadata": { + "id": "EhwcHgZC-ZYg", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "120a69d2-bdc2-4504-b27a-e9b5d66efc0c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m{\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'uno'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'dos'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'tres'\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "DM33a9uQsmpY" + }, + "source": [ + "\n", + "## 2.1 Indexing\n", + "\n", + "Unlike **sequences**, which are indexed by a range of integers, dictionaries are ***indexed by keys***:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "WGIQX2kNsmpZ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "5e0cd39d-738c-4538-a4f7-d83fe2727fea" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "89" + ] + }, + "metadata": {}, + "execution_count": 19 + } + ], + "source": [ + "# values can be accessed via keys\n", + "gradebook['James']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "yOPvz80fsmpa", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 158 + }, + "outputId": "f3a0365a-826c-4f9e-b0eb-a633534eb3ce" + }, + "outputs": [ + { + "output_type": "error", + "ename": "KeyError", + "evalue": "2", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# cannot be accessed by position\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mgradebook\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m: 2" + ] + } + ], + "source": [ + "# cannot be accessed by position\n", + "gradebook[2]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Nvh6eGjHsmpb" + }, + "source": [ + "Similar to lists, dictionaries (more precisely, dictionary values) are ***mutable*** and can grow and shrink as needed.\n", + "\n", + "Assigning a new value to an existing key updates an entry:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "nOwpX9kiWt6W", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "47d9142e-c698-4ec3-e87b-558ce3d436d9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 90, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 21 + } + ], + "source": [ + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "eRVOhjOnsmpd", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6ccea652-d321-4e22-abd8-0c9bf2e9b075" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "gradebook['Troy'] = 92\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "8GmjBbZ1hhJv", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9678f45b-0180-492c-c46f-9a9b786fd8f5" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'uno', 2: 'dos', 3: 'tres'}" + ] + }, + "metadata": {}, + "execution_count": 23 + } + ], + "source": [ + "spnum[1] = 'uno'\n", + "spnum" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dm6gPWK8Wt6X" + }, + "source": [ + "Assigning a new key and value adds an entry:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "pnRQC7jJsmpb", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "061e7620-030b-426a-a1f7-a20a74e8dfa8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89, 'Charles': 100}" + ] + }, + "metadata": {}, + "execution_count": 24 + } + ], + "source": [ + "gradebook['Charles'] = 100\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "mAN3T2HHhhJt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "bfd99f86-86c5-4a0d-a997-7ee4b7d59583" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'uno', 2: 'dos', 3: 'tres', 4: 'cuatro'}" + ] + }, + "metadata": {}, + "execution_count": 25 + } + ], + "source": [ + "spnum[4] = 'cuatro'\n", + "spnum" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "FH7T2mb9smpf" + }, + "source": [ + "Use the `del` statement with the key specified to delete an entry:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "sf8QmdYfsmpf", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "762efca2-a00d-4a59-f47c-7f7246c6cace" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "del gradebook['Charles']\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "VhusMz9IhhJx", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "231d7eb4-4b17-4fc1-d931-3defd94bb838" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'uno', 2: 'dos', 3: 'tres'}" + ] + }, + "metadata": {}, + "execution_count": 27 + } + ], + "source": [ + "del spnum[4]\n", + "spnum" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PHXi052tsmph" + }, + "source": [ + "Python dictionaries are nestable and versatile:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "s7wUyV4Fsmph", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "9ed93163-8852-4492-ef74-62ece2e30d9a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'fname': 'Joe',\n", + " 'lname': 'Fonebone',\n", + " 'age': 51,\n", + " 'spouse': 'Edna',\n", + " 'children': ['Ralph', 'Betty', 'Joey'],\n", + " 'pets': {'dog': {'name': 'Fido', True: ['healthy', 'lovely']}, 'cat': 'Sox'},\n", + " ('email', 'mobile'): 'contact info'}" + ] + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "person = {'fname': 'Joe', 'lname': 'Fonebone', 'age': 51, 'spouse': 'Edna', 'children': ['Ralph', 'Betty', 'Joey'],\n", + " 'pets': {'dog': {'name': 'Fido', True: ['healthy', 'lovely']}, 'cat': 'Sox'},\n", + " ('email', 'mobile'): 'contact info'}\n", + "person" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "25BJ69hBsmpk" + }, + "source": [ + "Simply append additional indicies or keys to retrieve values in a subsequence or subdictionary:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ia7oPYt1smpl", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "e9aa7ff2-40da-4566-af75-ab7c81e11725" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'lovely'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 30 + } + ], + "source": [ + "person['pets']['dog'][True][1]" + ] + }, + { + "cell_type": "markdown", + "source": [ + "*Exercise:* Use indexing operations to:\n", + "1. print the content 'Betty'.\n", + "2. delete the entry of the 'cat'." + ], + "metadata": { + "id": "BCJAJcGq7Mk1" + } + }, + { + "cell_type": "code", + "source": [ + "# write your codes here\n", + "person['children'][1]" + ], + "metadata": { + "id": "BDd5Rcg47XKL", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "cf98b13e-ac4f-45ee-8c0e-2db129597bc2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Betty'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 31 + } + ] + }, + { + "cell_type": "code", + "source": [ + "del person['pets']['cat']\n", + "person" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8kNYMlvO-heA", + "outputId": "695fee32-c286-449e-af05-de911e3c248f" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'fname': 'Joe',\n", + " 'lname': 'Fonebone',\n", + " 'age': 51,\n", + " 'spouse': 'Edna',\n", + " 'children': ['Ralph', 'Betty', 'Joey'],\n", + " 'pets': {'dog': {'name': 'Fido', True: ['healthy', 'lovely']}},\n", + " ('email', 'mobile'): 'contact info'}" + ] + }, + "metadata": {}, + "execution_count": 32 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yE6-9QyMsmpq" + }, + "source": [ + "\n", + "## 2.2 Working with Operators and Built-in Functions" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "KSQfY3YUsmpq" + }, + "source": [ + "Many of the operators and built-in functions that can be used with sequences work with dictionaries as well. But they operate ***primarily on keys of dictionaries***:\n", + "\n", + "- The membership operator: `in` or `not in`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "mD4eAJXBsmpq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3bf388e3-d6b0-46a3-a646-2d94cee9b127" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 33 + } + ], + "source": [ + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "OZANsgxyhhJ4", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "63997f5b-f3d4-4d23-a1fb-48ed32fef5b3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'uno', 2: 'dos', 3: 'tres'}" + ] + }, + "metadata": {}, + "execution_count": 34 + } + ], + "source": [ + "spnum" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "93FPtWKDsmpr", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "df6877bc-f7c2-4b11-9bbb-a954880d681b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 35 + } + ], + "source": [ + "'Troy' in gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "zesbqCHmsmpu", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "756f7483-2f7a-4a87-cf67-78f24da14510" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "False" + ] + }, + "metadata": {}, + "execution_count": 36 + } + ], + "source": [ + "'dos' in spnum" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "smFX60K_smpu" + }, + "source": [ + "- The `*` operator:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "UOmvcShzsmpv", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b312dbad-72ba-4c75-b57f-4ab7458e92c8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('Alice', ['Troy'], 'James')" + ] + }, + "metadata": {}, + "execution_count": 37 + } + ], + "source": [ + "head, *middle, tail = gradebook\n", + "head, middle, tail" + ] + }, + { + "cell_type": "code", + "source": [ + "head, *middle, tail" + ], + "metadata": { + "id": "2gvSGf3zo5Wv", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dd3cc847-cf6c-4193-e36d-92e99a16bd44" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "('Alice', 'Troy', 'James')" + ] + }, + "metadata": {}, + "execution_count": 38 + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "ZqxHc4lthhJ7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "da3cd6ed-83ac-45dd-8e4d-bf647df586f6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, [2, 3])" + ] + }, + "metadata": {}, + "execution_count": 39 + } + ], + "source": [ + "first, *rest = spnum\n", + "first, rest" + ] + }, + { + "cell_type": "code", + "source": [ + "first, *rest" + ], + "metadata": { + "id": "7cUbTYi2BBRu", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8a5e0ca7-e604-4477-e3b3-2094bf872883" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(1, 2, 3)" + ] + }, + "metadata": {}, + "execution_count": 40 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "1QjonRsXsmpy" + }, + "source": [ + "- The following show the effects of common built-in fucntions when working with dictionaries:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "e8QJnTKIsmpy", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "adaabc7e-2784-4f72-94e5-0f0ca8d444a9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Troy'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 41 + } + ], + "source": [ + "max(gradebook)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "80HODaL8smpy", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2591c443-152a-434e-bb13-5193e876e76b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1" + ] + }, + "metadata": {}, + "execution_count": 42 + } + ], + "source": [ + "min(spnum)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "ii_AhqQ2smpz", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ba7f36b6-2ee2-4ac1-9e0c-d74acef1d28c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Alice', 'James', 'Troy']" + ] + }, + "metadata": {}, + "execution_count": 43 + } + ], + "source": [ + "sorted(gradebook)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "tPGTMV-tsmpz", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f1b5ef30-29dd-4679-8f8f-2bd66a557ae1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "execution_count": 44 + } + ], + "source": [ + "len(spnum)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dG-Ayd3-smp1" + }, + "source": [ + "\n", + "## 2.3 Dictionary Methods\n", + "\n", + "As with lists and tuples, there are several built-in methods that can be invoked on dictionaries.\n", + "\n", + "Call `dir()` to list all the names available for a dictionary object:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "mS6mWsD5smp2", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "016f73e7-5896-4e6e-9073-18d8e52b0bf9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['__class__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__delitem__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__reversed__',\n", + " '__setattr__',\n", + " '__setitem__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " 'clear',\n", + " 'copy',\n", + " 'fromkeys',\n", + " 'get',\n", + " 'items',\n", + " 'keys',\n", + " 'pop',\n", + " 'popitem',\n", + " 'setdefault',\n", + " 'update',\n", + " 'values']" + ] + }, + "metadata": {}, + "execution_count": 119 + } + ], + "source": [ + "dir(gradebook)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "RALfTHposmp3" + }, + "source": [ + "\n", + "\n", + "- [`.get([, ])`](https://docs.python.org/3/library/stdtypes.html#dict.get) returns the value for `key` if `key` is present, else `default` (defaulting to `None`):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "S_G-bh5KYgbq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "327c6491-18e4-4742-e94b-eab66b8aa569" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89}" + ] + }, + "metadata": {}, + "execution_count": 45 + } + ], + "source": [ + "gradebook = {'Alice': 95, 'Troy': 92, 'James': 89}\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "FXyYsHPtsmp3", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "b94d7189-b9a9-4fc9-b0a7-e39045b33576" + }, + "outputs": [ + { + "output_type": "error", + "ename": "KeyError", + "evalue": "'Bryn'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mgradebook\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Bryn'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m: 'Bryn'" + ] + } + ], + "source": [ + "gradebook['Bryn']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "h-r_AYuAsmp3" + }, + "outputs": [], + "source": [ + "gradebook.get('Bryn') # return nothing but won't interrupt exectution" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "dVa2J9zWsmp4", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "855f4e90-f215-47da-ca94-c0f338d92d1c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0" + ] + }, + "metadata": {}, + "execution_count": 48 + } + ], + "source": [ + "gradebook.get('Bryn', 0) # return 0" + ] + }, + { + "cell_type": "markdown", + "source": [ + "**Question**: Given the following list:\n", + "\n", + "```python\n", + "fruits = ['apple', 'pear', 'peach', 'banana', 'apple',\n", + " 'strawberry', 'lemon', 'apple', 'blueberry', 'banana']\n", + "```\n", + "\n", + "Write code to count the number of duplicates for each unique fruit. Use a Python dictionary to maintain each pair of the fruit name and its count.\n", + "\n", + "The expected output is as follows:\n", + "\n", + "```python\n", + "{'apple': 3, 'pear': 1, 'peach': 1, 'banana': 2, 'strawberry': 1,\n", + " 'lemon': 1, 'blueberry': 1}\n", + "```" + ], + "metadata": { + "id": "D0NEVia7G7cX" + } + }, + { + "cell_type": "code", + "source": [ + "fruits = ['apple', 'pear', 'peach', 'banana', 'apple',\n", + " 'strawberry', 'lemon', 'apple', 'blueberry', 'banana']\n", + "\n", + "# write your code below (hint: use for loop and .get() method)\n", + "\n", + "fruits_count = {}\n", + "for name in fruits:\n", + " fruits_count[name] = fruits_count.get(name, 0) + 1\n", + "fruits_count" + ], + "metadata": { + "id": "FF3h3BljHDX0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3b14a1ad-bd8b-455e-952d-93af7f4bcbfd" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'apple': 3,\n", + " 'pear': 1,\n", + " 'peach': 1,\n", + " 'banana': 2,\n", + " 'strawberry': 1,\n", + " 'lemon': 1,\n", + " 'blueberry': 1}" + ] + }, + "metadata": {}, + "execution_count": 49 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "w1b8ft4tsmqG" + }, + "source": [ + "- [`.update()`](https://docs.python.org/3/library/stdtypes.html#dict.update) merges a dictionary with\n", + "\n", + " - another dictionary;\n", + " - an object that can produce pairs of keys and values (e.g., a list of tuples that represent key-value pairs);" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "1EcG1NcLsmqH", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "1b37d3d6-a10a-4147-ee99-961f2696ebf2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'one', 2: 'dos', 3: 'tres', 4: 'four'}" + ] + }, + "metadata": {}, + "execution_count": 50 + } + ], + "source": [ + "spnum = {1: 'uno', 2: 'dos', 3: 'tres'}\n", + "spnum.update({1: 'one', 4: 'four'})\n", + "spnum" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "JyxxyoowsmqI", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d5ea0a8f-01bb-4ba9-a18a-bf437e48582b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 95, 'Troy': 92, 'James': 89, 'Amy': 77, 'Peter': 85, 'Mike': 63}" + ] + }, + "metadata": {}, + "execution_count": 51 + } + ], + "source": [ + "gradebook.update({'Amy': 77, 'Peter': 85, \"Mike\": 63})\n", + "gradebook" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "MlsSnKtgsmqI", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "bc4c11cd-68d1-4c8a-fd93-c50d56a0c69b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1: 'uno', 2: 'dos', 3: 'tres', 4: 'cuatro'}" + ] + }, + "metadata": {}, + "execution_count": 52 + } + ], + "source": [ + "spnum.update([(1, 'uno'), (4, 'cuatro')]) # or [[1, 'uno'], [4, 'cuatro']]\n", + "spnum" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "RfN5bPM6RWIH" + }, + "source": [ + "\n", + "### Methods for Dictionary Traversals\n", + "\n", + "We'll often be in situations where we want to traverse the keys and values of a dictionary separately.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "woXSa_OPsmqP" + }, + "source": [ + "- [`values()`](https://docs.python.org/3/library/stdtypes.html#dict.keys) ([`keys()`](https://docs.python.org/3/library/stdtypes.html#dict.keys)) returns a **dictionary view** consisting of only `value`s (`key`s):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "CRdErOAXsmqP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e2801630-839e-4c3d-8b78-71a34fac7397" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict_values(['uno', 'dos', 'tres', 'cuatro'])" + ] + }, + "metadata": {}, + "execution_count": 53 + } + ], + "source": [ + "spnum.values() # a dictionary view object" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "JAa3uScHsmqP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6317debb-0231-4420-9070-48fafb946c34" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict_keys([1, 2, 3, 4])" + ] + }, + "metadata": {}, + "execution_count": 54 + } + ], + "source": [ + "spnum.keys()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IyIF53FPRWIM" + }, + "source": [ + "Dictionary views are read-only and dynamic. They will be updated when we modify the dictionary from which they are derived." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "1asuTyS8smqL" + }, + "source": [ + "- [`items()`](https://docs.python.org/3/library/stdtypes.html#dict.items) returns a **dictionary view** consisting of `(key, value)` pairs:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "R8QULhAlRWIJ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2d112919-00a3-48d4-b5f2-0e11cf3317b2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict_items([('Alice', 95), ('Troy', 92), ('James', 89), ('Amy', 77), ('Peter', 85), ('Mike', 63)])" + ] + }, + "metadata": {}, + "execution_count": 55 + } + ], + "source": [ + "gradebook.items()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "cSImmHVzsmqL", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "26a0868a-6038-4eec-f716-cf12011a3a43" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict_items([(1, 'uno'), (2, 'dos'), (3, 'tres'), (4, 'cuatro')])" + ] + }, + "metadata": {}, + "execution_count": 56 + } + ], + "source": [ + "spnum.items()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "7eZDyPcmRWIM" + }, + "source": [ + "Dictionary views can be iterated over to yield their respective data:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "gTYdQV_0RWIM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ffd1f488-9631-42d6-f309-35c388dc429e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[('Alice', 100),\n", + " ('Troy', 97),\n", + " ('James', 94),\n", + " ('Amy', 82),\n", + " ('Peter', 90),\n", + " ('Mike', 68)]" + ] + }, + "metadata": {}, + "execution_count": 57 + } + ], + "source": [ + "[(name, score + 5) for name, score in gradebook.items()]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0EDgCykfRWIN" + }, + "source": [ + "We can use the dictionary-like syntax in comprehensions (i.e., **dictionary comprehensions**) to construct new dictionaries from existing ones:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Y2iPoaB6RWIN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f8c583e9-decb-43f4-c17b-f72e3e816456" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'Alice': 100, 'Troy': 97, 'James': 94, 'Amy': 82, 'Peter': 90, 'Mike': 68}" + ] + }, + "metadata": {}, + "execution_count": 58 + } + ], + "source": [ + "{name: score + 5 for name, score in gradebook.items()}" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "l88aW2dcsmqR" + }, + "source": [ + "\n", + "## 2.4 Conversions\n", + "\n", + "\n", + "A dictionary can also be constructed by casting a collection of key-value pairs to the `dict` type with the `dict()` function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "center", + "id": "0ZnVvVaqsmqR", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0413d479-7841-4ba1-feba-4a516ff0600c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'red': 34, 'green': 30, 'brown': 31}" + ] + }, + "metadata": {}, + "execution_count": 59 + } + ], + "source": [ + "dict([(\"red\", 34), (\"green\", 30), (\"brown\", 31)]) # or dict(((\"red\", 34), (\"green\", 30), (\"brown\", 31)))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9RMCmL0ssmqS" + }, + "source": [ + "We have to be more careful when converting a dictionary to a collection of other types:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ck_LCtnQsmqS", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "84e52380-c1b7-436f-b4f4-c5cf63c953c6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'red': 34, 'green': 30, 'brown': 31}" + ] + }, + "metadata": {}, + "execution_count": 60 + } + ], + "source": [ + "marbles = dict([(\"red\", 34), (\"green\", 30), (\"brown\", 31)])\n", + "marbles" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "EAuly_C1smqT", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "6d6f2ec8-85f3-412a-c8ec-a3b1f57a25fe" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['red', 'green', 'brown']" + ] + }, + "metadata": {}, + "execution_count": 61 + } + ], + "source": [ + "list(marbles) # the keys will be used by default" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "HYFEWGLSsmqU", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "46c0d9a7-0c12-40d7-84a0-484c6847296a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(34, 30, 31)" + ] + }, + "metadata": {}, + "execution_count": 62 + } + ], + "source": [ + "# use a view to get the values\n", + "tuple(marbles.values())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "HFwi3xc4smqU", + "scrolled": true, + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "dec722f2-5722-480e-bc30-3df16fbae89a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[('red', 34), ('green', 30), ('brown', 31)]" + ] + }, + "metadata": {}, + "execution_count": 63 + } + ], + "source": [ + "# or the key-value pairs\n", + "list(marbles.items())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "BtEc5PLNsmqZ" + }, + "source": [ + "\n", + "
\n", + "\n", + "# 3 Sets\n", + "\n", + "A set is an ***unordered***, ***mutable*** collection of ***distinct immutable*** elements.\n", + "\n", + "***Non-empty*** sets can be created by using the curly brace notation (`{}`):\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "RnTDmCYXWt6w", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e5565d3d-fa0c-4e0a-faaa-6542f8e4cf3e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5}" + ] + }, + "metadata": {}, + "execution_count": 1 + } + ], + "source": [ + "integers = {5, 2, 3, 1, 4, 2}\n", + "integers # The duplicate is eliminated" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7VMI_oEnsmqa", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b0a2b563-0938-486f-81bf-2a4b4bcc2b07" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "set" + ] + }, + "metadata": {}, + "execution_count": 2 + } + ], + "source": [ + "type(integers)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "SLyPbM6zWt6w", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "700366e7-6774-4b5c-9fa7-77a362b9bc9b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'cat', 'dog', 'pig', 'rabbit'}" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "mammals = {'cat', 'dog', 'rabbit', 'pig', 'cat'}\n", + "mammals # The duplicate is eliminated" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PhQcDDY_ZX4g" + }, + "source": [ + "An ***empty*** set can only be defined with the `set()` function." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "i0k9cDF2ZYqo", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b996b58e-ff92-449a-fcf3-d993a34737b7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "dict" + ] + }, + "metadata": {}, + "execution_count": 67 + } + ], + "source": [ + "type({})" + ] + }, + { + "cell_type": "code", + "source": [ + "type(set())" + ], + "metadata": { + "id": "bGSB6VtzroBa", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c6a2a81f-c2cf-4790-c585-b0045582bf2c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "set" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "18MKryUl4nEt", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fae56f32-18f5-4761-e7a6-6c57ebde3fec" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'apple', 'banana', 'mango', 'orange'}" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "set(fruits * 3)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "SSOOhg9Csmqc" + }, + "source": [ + "\n", + "\n", + "\n", + "The elements in a set can be objects of different types. But they must be ***immutable***:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "Kpy77DVssmqc", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "41422748-2427-4060-d625-b6abc75bc988" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{('Amy', True), 3.14159, 42, None, 'ham'}" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ], + "source": [ + "{42, 'ham', 3.14159, None, ('Amy', True)}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "QhEcHsiosmqd", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 141 + }, + "outputId": "8fdfc344-5d74-482d-8a68-b28a8e2e3568" + }, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m{\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'ham'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3.14159\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'Amy'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m}\u001b[0m \u001b[0;31m# lists are mutable and cannot be the elements in a set\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "{42, 'ham', 3.14159, None, ['Amy', True]} # lists are mutable and cannot be the elements in a set" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "iuPE67Nosmqe" + }, + "source": [ + "\n", + "\n", + "Like other collections, sets support membership operators `in` and `not in` and built-in function `len()`:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "EX0Z4_6lsmqf", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "52d549c8-af6c-4626-c503-4008a5190c5e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ], + "source": [ + "'parrot' not in mammals" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cell_style": "split", + "id": "3j19HYzzsmqe", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f2e3c096-b496-406c-f5d7-784937e72ae0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "5" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "len(integers)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "r6_V3Kxmsmqf" + }, + "source": [ + "However, sets do not support indexing, slicing, or other ***sequence-like*** behavior, because they do not record element position or order of insertion." + ] + } + ], + "metadata": { + "colab": { + "provenance": [], + "toc_visible": true + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.13" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/course_materials/Topic_3_Control_Structures_(with answers).ipynb b/course_materials/Topic_3_Control_Structures_(with answers).ipynb new file mode 100644 index 0000000..4373bbe --- /dev/null +++ b/course_materials/Topic_3_Control_Structures_(with answers).ipynb @@ -0,0 +1 @@ +{"cells":[{"cell_type":"markdown","metadata":{"id":"L-IWldJT1QF_"},"source":["\n","# 1 Python Expressions and Statements\n","\n","\n","A combination of objects and operators that evaluates to a value/object (by itself a simple expression):\n","\n","\n","|Expression|Meaning|\n","|:-- |:-- |\n","|`(...)`, `[...]`, `{key: value...}`, `{...}`|Grouping, list display, dictionary display, set display (comprehension) |\n","|`x[index]`, `x[index:index]`, `x(arguements...)`, `x.attribute`|Indexing, slicing, call, attribute reference|\n","|`x ** y`|Exponentiation|\n","|`+x`, `-x`|Identity, negation|\n","|`x * y`, `x / y`, `x // y`, `x % y`|Multiplication (repetition), division, integer division, remainder (format)|\n","|`x + y`, `x - y`|Addition (concatenation), substraction|\n","|`x < y`, `x <= y`, `x > y`, `x >= y`, `x == y`, `x != y`,
`x in y`, `x not in y`, `x is y`, `x is not y`|Comparisons, membership tests, identity tests|\n","|`not x`|Logical negation|\n","|`x and y`|Logical AND|\n","|`x or y`|Logical OR|\n","|`x if y else z`| Conditional selection |\n","|`lambda arguments: expression`|Anonymous function generation|\n","\n","
\n","Python expressions cannot span multiple lines."]},{"cell_type":"markdown","metadata":{"id":"HG-Ei5nq1QGB"},"source":["---\n","\n","**Statements** (typically one per line) are the larger logic of a program's operation, and the **basic units of instruction** that the Python interpreter parses and processes.\n","\n","Statements use and direct (thereby embed) expressions to process objects.\n","\n","\n","|Statement|Role|Example\n","|:-- |:-- |:-- |\n","|Assignment: `=`|Creating and assigning references|`a, b = 'good', 'bad'`
`ls = [1, 5]; ls[1] = 2; ls[2:2] = [3, 4]` |\n","|Augmented assignment:
`+=`, `-=`, `*=`, `/=`, `%=`, etc.| Combining a binary operation and
an assignment statement|`a *= 2`
`a += b` |\n","|`del`|Deleting references|`del variable`
`del object.attribute`
`del data[index]`
`del data[index:index]`|\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"9GjcGcggI3Z8"},"outputs":[],"source":["x = 7 % 3 # statements use expressions"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":106},"id":"SIyMpNZ9I3Z9","outputId":"fbeb0dca-d732-45c8-a4a4-9d04e32b9111","executionInfo":{"status":"error","timestamp":1708937556213,"user_tz":-480,"elapsed":419,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"SyntaxError","evalue":"invalid syntax. Maybe you meant '==' or ':=' instead of '='? (, line 1)","traceback":["\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m (x = 7) % 3 # but not the other way around!\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax. Maybe you meant '==' or ':=' instead of '='?\n"]}],"source":["(x = 7) % 3 # but not the other way around!"]},{"cell_type":"markdown","metadata":{"id":"GLN14Y87I3Z9"},"source":["\n","In general, the interpreter executes statements ***sequentially***, one after the next as it encounters them."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"alFh6R-nI3Z-","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708937632480,"user_tz":-480,"elapsed":312,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"25551e52-5492-4a7e-aab5-333c5f9b3895"},"outputs":[{"output_type":"stream","name":"stdout","text":["Charles is a male at 30 years old.\n"]}],"source":["name = \"Charles\"\n","age = 30\n","gender = \"male\"\n","print(name, 'is a', gender, 'at', age, 'years old.')"]},{"cell_type":"markdown","metadata":{"id":"iGR4TpSs1QGO"},"source":["\n","
\n","\n","\n","In many cases, we want programs to have behaviors other than **sequential execution** of statements.\n","\n","For a bank to consider whether or not to offer someone a loan:\n"]},{"cell_type":"markdown","metadata":{"cell_style":"center","id":"ODb6fCqo1QGR"},"source":["\n","| Name | Income | Decision |\n","|-----|-----|-----|\n","| Amy | 27 | ? |\n","\n","\n","\n","Pseudo code:\n","
\n","\n","if income >= 30 => approve\n","\n","else => reject\n","\n","
"]},{"cell_type":"markdown","metadata":{"id":"NQEKyquU1QGT"},"source":["\n","\n","**Control structures** direct the order of execution of the statements and allow programmers to put some \"logic\" into their python code.\n","\n","Two groups of **control flow statements**:\n","\n","- Conditionals:\n","\n"," - `if` statements\n","\n","- Loops:\n"," - `for` statements (***definite*** loops)\n"," - `while` statements (***indefinite*** loops)\n"," \n","These statements contain (groups of) other statements (spanning multiple lines), and are called **compound statements**."]},{"cell_type":"markdown","metadata":{"id":"PBxb2kWC1QGU"},"source":["\n","
\n","\n","# 2 Conditional Execution: The `if` Statement\n","\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"tECSWmEcxh6r"},"source":["\n","## 2.1 Basic Format\n","\n","The `if` statement tests a condition and acts on it depending on whether it's ***true*** or ***false***.\n","\n","The simplest form is as follows:\n"]},{"cell_type":"markdown","metadata":{"id":"IAuAa2O31QGV"},"source":["\n","
\n","if <condition>:             # The colon (:) is required\n","                            # Indentation is used to define a group of statements.\n","
statement 1 \n"," statement 2 \n"," ...\n"," statement N
\n","following statement(s)\n","
\n","\n","
\n","\n","- `` is an expression that evaluates to a **Boolean value**.\n","\n","- Contiguous statements ***at the matching indentation level*** are considered part of the same group. They are executed (***sequentially***) only if `` is `True`. Indentation is part of Python's syntax. It defines the grouping of statements.\n","\n","- If `` is `False`, the entire group is skipped over and not executed.\n","\n","---"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"KSb2sPvYI3aE","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708938268070,"user_tz":-480,"elapsed":15978,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"99fd12c2-f13a-46d7-bc5b-ba1b9eee7642"},"outputs":[{"output_type":"stream","name":"stdout","text":["Please enter the income of the customer: 40\n","The customer's monthly income is 40.0K\n","Approve!\n"]}],"source":["income=float(input('Please enter the income of the customer: '))\n","\n","if income >= 30: # check if the condition is met or not\n"," print(f\"The customer's monthly income is {income}K\")\n"," print(\"Approve!\")"]},{"cell_type":"markdown","metadata":{"id":"wjdevCKJiUlZ"},"source":["Non-Boolean values can be used in place of ``. Rules for deciding the truthiness or falsehood of a non-Boolean value:\n","\n","- All ***non-zero*** numbers and all ***non-empty*** strings are true;\n","\n","- `0` and the ***empty*** string (`\"\"`) are false;\n","\n","- Other built-in data types that can be considered to be ***empty*** or ***not empty*** follow the same pattern."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"UPYqZRPvH_8X","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708938396212,"user_tz":-480,"elapsed":317,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"584cd4f3-d1af-4ffa-d470-e9e9b0a1bd30"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["False"]},"metadata":{},"execution_count":6}],"source":["# without executing the code, predict the return value\n","bool(\"\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"RCGq2ZPtISCp","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708938402079,"user_tz":-480,"elapsed":454,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"6ecb7341-2d88-4fc2-faaa-a0f8dda229e9"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["False"]},"metadata":{},"execution_count":7}],"source":["# without executing the code, predict the return value\n","bool([])"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"RBMCPV3BI3aD","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708938443541,"user_tz":-480,"elapsed":288,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"692995c2-37fe-425c-9749-4c5c839c104d"},"outputs":[{"output_type":"stream","name":"stdout","text":["Hello, Amy!\n"]}],"source":["name = 'Amy'\n","if name:\n"," print(f\"Hello, {name}!\")"]},{"cell_type":"markdown","metadata":{"id":"pUvGXayBItcy"},"source":["Notice: It is permissible to condense the clause header and the entire group on one line with `;` separating them:\n","\n","
\n","if <condition>: statement 1; statement 2, ...; statement N
"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"6yVzNHIKIyHq","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708938527344,"user_tz":-480,"elapsed":301,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"09a7c486-4438-4551-d543-1adf4e3aaa8d"},"outputs":[{"output_type":"stream","name":"stdout","text":["Hello, Amy!\n","Hello, Amy+1!\n","Hello, Amy+2!\n"]}],"source":["name = 'Amy'\n","if name: print(f\"Hello, {name}!\"); print(f\"Hello, {name}+1!\"); print(f\"Hello, {name}+2!\")"]},{"cell_type":"markdown","metadata":{"id":"W51jhFDXI3aF"},"source":["\n","\n","## 2.2 Multiway Branching: The `else` and `elif` Clauses\n","\n","\n","\n","The optional `elif` (short for *else if*) and `else` clauses allows conditional execution to be based on multiple alternatives.\n","\n","
\n","\n","\n","\n","\n","Here is a code skeleton that shows the full potention of an `if` statement:\n","\n","
\n","if <condition 1>:\n","   statement(s)         \n","\n","elif <condition 2>:\n","   statement(s)\n","   \n","   ...\n","\n","elif <condition N>:\n","   statement(s)   \n","\n","else:                      # All clause headers are all at the same indentation level.\n","   statement(s)\n","\n","following statement(s)\n","
\n","\n","\n","\n","- An arbitrary number of `elif` clauses can be specified. Conditions are evaluated in turn and the block corresponding to the first that is `True` is executed.\n"," \n","- Once one of the expressions is `True` and its block is executed, none of the remaining expressions are tested.\n","\n","- If none of the expressions are `True`, and the group of an ***optional*** `else` clause is executed if specified.\n","\n"," - There can be only one `else` clause, and it must be specified last.\n"," \n"," \n","\n"," \n","\n","---\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"6Nh4PGpeI3aG","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708939033405,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"500615f6-5d67-4a7f-e686-2fc883a53350"},"outputs":[{"output_type":"stream","name":"stdout","text":["The customer's monthly income is 50K\n","Collect more information!\n","Done\n"]}],"source":["income = 50\n","\n","print(f\"The customer's monthly income is {income}K\")\n","\n","if income >= 70:\n"," print(\"Approve!\")\n","elif income >= 30: # why not 30 <= income < 70?\n"," print(\"Collect more information!\")\n","else:\n"," print(\"Reject!\")\n","\n","print(\"Done\")"]},{"cell_type":"markdown","metadata":{"id":"922WdGwwKPWn"},"source":["\n","\n","*Exercise:* Following the same logic, try to write codes for the above decision rule."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"rH5XP269KVTJ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708939254073,"user_tz":-480,"elapsed":459,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fcfe9823-7cfd-4c82-d477-4922516f81cc"},"outputs":[{"output_type":"stream","name":"stdout","text":["The customer's monthly income is 60K\n","Conditionally approve!\n","Done\n"]}],"source":["#write your codes here\n","income = 60\n","\n","print(f\"The customer's monthly income is {income}K\")\n","\n","if income >= 70:\n"," print(\"Approve!\")\n","elif income >= 50:\n"," print(\"Conditionally approve!\")\n","elif income >= 30:\n"," print(\"Collect more information!\")\n","else:\n"," print(\"Reject!\")\n","\n","print(\"Done\")"]},{"cell_type":"markdown","metadata":{"id":"3KMM-HKJkP9v"},"source":["
\n","\n","## 2.3 Nested `if` statements\n","\n","\n","An `if` statement enclosed inside another `if` statement is called a ***nested*** `if` statement.\n","\n","\n"," `if` statements can nest (***to arbitrary depth***) to formulate more complicated conditionals.\n","\n","\n","\n"," | Name | Income | Criminal | Result |\n","|-----|-----|-----|-----|\n","| Amy | 27 | No | ? |\n","\n","\n","\n","\n","\n","\n","Pseudo code:\n","\n","
\n","if income >= 30 => approve\n","else =>\n","     if criminal == No => approve\n","     else => reject\n","
"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Q9jLhZjZI3aH"},"outputs":[],"source":["income = 27\n","criminal = \"No\"\n","\n","if income >= 30:\n"," print('Approve!')\n","else:\n"," if criminal == \"No\":\n"," print('Approve!')\n"," else:\n"," print('Reject!')\n","\n","print(\"Done\")"]},{"cell_type":"markdown","metadata":{"id":"C0A8aKmrSgrt"},"source":["Can you use `elif` to implement the same function?"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"9ErPs2JISp7G","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708939609401,"user_tz":-480,"elapsed":311,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"816866f2-f077-4acd-b01d-e6bf12372abc"},"outputs":[{"output_type":"stream","name":"stdout","text":["Approve!\n","Done\n"]}],"source":["# write your codes here\n","income = 27\n","criminal = \"No\"\n","\n","if income >= 30:\n"," print('Approve!')\n","elif criminal == \"No\":\n"," print('Approve!')\n","else:\n"," print('Reject!')\n","\n","print(\"Done\")"]},{"cell_type":"markdown","metadata":{"id":"CBoghJzLI3aI"},"source":["\n","---\n","\n","** Question**: Write code to describe the decision rules represented by the following decision tree:\n","\n","| Name | Income | Years | Criminal | Result |\n","|-----|-----|-----|-----|-----|\n","| Amy | 27 |4.2 | No | ? |\n","\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"rLA3rsLCI3aI","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708939923033,"user_tz":-480,"elapsed":273,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fb3cd110-06b1-47b9-84b2-3576210dc8bb"},"outputs":[{"output_type":"stream","name":"stdout","text":["Approve!\n"]}],"source":["# try to write code for it by yourself\n","\n","customer = {'Name': 'Amy', 'Income': 27, 'Years': 4.2, 'Criminal': 'No'}\n","\n","# code that implements the decision rule\n","\n","if customer['Income'] >= 70:\n"," print('Approve!')\n","elif customer['Income'] >= 30:\n"," if customer['Years'] >= 2:\n"," print('Approve!')\n"," else:\n"," print('Reject!')\n","else:\n"," if customer['Criminal'] == 'No':\n"," print('Approve!')\n"," else:\n"," print('Reject!')"]},{"cell_type":"markdown","metadata":{"id":"9327fVBG1QHE"},"source":["\n","\n","
\n","\n","## 2.4 Conditional Expressions\n","\n","Python supports an additional decision-making entity called a **conditional expression**.\n","\n","The **conditional operator** has 3 operands. The syntax is as follows:\n","\n","
\n","\n","
<expression 1> if <condition> else <expression 2>   # The else part is mandatory
\n","\n","\n","
\n","\n","- `` is evaluated first:\n","\n"," - if `True`, the expression evaluates to ``;\n"," \n"," - otherwise, the expression evaluates to ``.\n","\n","\n","
\n","\n","The conditional operator provides a syntactic shorthand for the normal `if` statement.\n","\n","\n"," \n","
\n","if a < b:\n","   print('a is less than b')\n","else:\n","   print('a is greater than or equal to b')\n","
\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"n0fXzuNbndF8","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940098559,"user_tz":-480,"elapsed":312,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"7248dff1-2c5b-4ef1-d0b8-772f870bdc13"},"outputs":[{"output_type":"stream","name":"stdout","text":["a is less than b\n"]}],"source":["a, b = 3, 7\n","print('a is less than b') if a < b else print('a is greater than or equal to b')"]},{"cell_type":"markdown","metadata":{"id":"tSNr3Ha1TrHX"},"source":["A common use of the conditional expression is to select variable assignment.\n","\n","For example, suppose you want to find the larger one of two numbers. Of course, there is a built-in function max() that does just this (and more) that you could use. But suppose you want to write your own code from scratch."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"TlcdUWJ6TtQX"},"outputs":[],"source":["if a > b:\n"," m = a\n","else:\n"," m = b"]},{"cell_type":"markdown","metadata":{"id":"co-CL7ERTut3"},"source":["Compare it with a conditional expression"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"75wUZvPTTv19","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940239840,"user_tz":-480,"elapsed":321,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e52260d5-c166-49ef-f25c-a526ca0281c1"},"outputs":[{"output_type":"stream","name":"stdout","text":["3\n","7\n","7\n"]}],"source":["a, b = 3, 7\n","print(a)\n","print(b)\n","\n","m = a if a > b else b\n","print(m)\n"]},{"cell_type":"markdown","metadata":{"id":"oGIdrvxn1QHL"},"source":["The conditional expression has lower precedence than virtually all the other operators:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"7zifmINa1QHM"},"outputs":[],"source":["x = y = 1 # chained assignment that sets both x and y to 1"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"DXlZ6Z1x1QHQ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940337169,"user_tz":-480,"elapsed":3,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9eee2536-171f-436e-c464-c58bbfd6e858"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["16"]},"metadata":{},"execution_count":19}],"source":["5 + (x if x >= y else y) + 10"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"WHv32Lvn1QHh","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940378058,"user_tz":-480,"elapsed":655,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"10ca963a-4d6b-4c4a-f892-a8f566db5f64"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["6"]},"metadata":{},"execution_count":20}],"source":["5 + x if x >= y else y + 10"]},{"cell_type":"markdown","metadata":{"id":"BTDWrrrl1QHk"},"source":["\n","
\n","\n","# 3 Indefinitive Loops: The `while` Statement\n","\n","A `while` loop repeats a sequence of statements until a particular condition is no longer satisfied.\n","\n","The simplest form of a `while` loop is shown below:\n","\n","
\n","\n","
while <condition>:            # The colon (:) is required\n","                              # Again, indentation is used for grouping\n","
statement 1 \n"," statement 2 \n"," ...\n"," statement N
\n","following statement(s)\n","
\n","\n","
\n","\n","- When a `while` loop is encountered, `` is first evaluated to return a **Boolean value**.\n","\n"," - `` is typically formulated with a variable (called a *counter*) whose value changes with iterations.\n","\n","- Statements ***indented to the same level*** are referred to as the **loop body** and executed if `` is `True`.\n"," \n","- `` is then checked again.\n"," \n","- Execution repeats these two steps until `` becomes `False`.\n"]},{"cell_type":"markdown","metadata":{"id":"2JmYClkzI3aM"},"source":["\n","\n",""]},{"cell_type":"code","execution_count":null,"metadata":{"id":"xY5vf-4O1QHk","scrolled":true,"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940666858,"user_tz":-480,"elapsed":313,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d29b55e5-31a0-4f65-dff9-40c042cde8ab"},"outputs":[{"output_type":"stream","name":"stdout","text":["5\t4\t3\t2\t1\tComplete!\n"]}],"source":["n = 5\n","while n > 0: # n is the counter\n"," print(n, end='\\t')\n"," n = n - 1 # modify the value of the counter in every iteration\n","print(\"Complete!\")"]},{"cell_type":"markdown","metadata":{"id":"03_li4ZDI3aN"},"source":["\n","|Round No.| Value of Counter `n`| Value of Condition `n > 0`| Printed Output|\n","|:-- |:-- |:-- |:-- |\n","|1|`5`|`True`| `5`|\n","|2|`4`|`True`| `4`|\n","|3|`3`|`True`| `3`|\n","|4|`2`|`True`| `2`|\n","|5|`1`|`True`| `1`|\n","|6|`0`|`False`| ❌ |"]},{"cell_type":"markdown","metadata":{"id":"Pb7rff5MYp6l"},"source":["If we want to print the string \"spam\" as follows: spam-> pam-> am-> m"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"-a8Rar4tI3aN","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940803867,"user_tz":-480,"elapsed":292,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"68883b3b-0302-42bd-a26f-94d3e830c32d"},"outputs":[{"output_type":"stream","name":"stdout","text":["spam\tpam\tam\tm\t"]}],"source":["s = 'spam'\n","while s: # while s is not empty; more concise than s != ''\n"," print(s, end='\\t')\n"," s = s[1:]"]},{"cell_type":"markdown","metadata":{"id":"tHaW8ECh1QHn"},"source":["\n","- `while` loops can be nested to arbitrary depth.\n","\n","\n","- `while` loops can be nested inside `if` statements, and vice versa.\n","\n","What does the following program do?"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"-zqowxik1QHn","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940914805,"user_tz":-480,"elapsed":322,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"0dc871c9-703f-489e-bc75-b3784523c293"},"outputs":[{"output_type":"stream","name":"stdout","text":["5\t3\t1\t"]}],"source":["n = 5\n","while n:\n"," if n % 2 == 1:\n"," print(n, end='\\t')\n"," n = n - 1"]},{"cell_type":"markdown","metadata":{"id":"DteiHCcbZzFn"},"source":["*Exercise:* Write a program to print all even numbers whose squares are smaller than 100 (the expected output would be 0,2,4,6,8)."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Gqouc7TUaCi_"},"outputs":[],"source":["# write your codes here\n"]},{"cell_type":"markdown","metadata":{"id":"Mu5_qbUYaNyV"},"source":["- A `while` loop can also be specified on one line (for your knowledge, but in practice mostly written in multiple lines to make the logic clear):\n","\n","
while <condition>: statement 1; statement 2; ...; statement N
\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"jeHzxBO-bQhB","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708940976415,"user_tz":-480,"elapsed":296,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e33fa3bf-527f-4011-8f31-99d040ee6c22"},"outputs":[{"output_type":"stream","name":"stdout","text":["5\t4\t3\t2\t1\t"]}],"source":["n = 5\n","while n > 0: # n is the counter\n"," print(n, end='\\t')\n"," n = n - 1"]},{"cell_type":"markdown","metadata":{"id":"gTNWbOiBbRpo"},"source":["Try to rewrite the above codes in one line"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"4VcsNc8cbWeh","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1708941009944,"user_tz":-480,"elapsed":7,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3a4098ee-8448-44f2-ef07-e45a5955f7a7"},"outputs":[{"output_type":"stream","name":"stdout","text":["5\t4\t3\t2\t1\t"]}],"source":["# write your codes here in one line\n","n = 5\n","while n > 0: print(n, end='\\t'); n = n - 1"]},{"cell_type":"markdown","metadata":{"id":"0261MrhZ1QHr"},"source":["- If we accidentally write a `while` loop that theoretically never ends, the code can be terminated by click Interrupt in the Kernel/Runtime menu.\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"yeB7AETFI3aO","colab":{"base_uri":"https://localhost:8080/","height":393},"executionInfo":{"status":"error","timestamp":1708941052302,"user_tz":-480,"elapsed":13504,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"49d62b28-85a2-4fa7-e3f0-1747caa89813"},"outputs":[{"output_type":"stream","name":"stdout","text":["5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5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5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t5\t"]},{"output_type":"error","ename":"KeyboardInterrupt","evalue":"","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mn\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0;36m2\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'\\t'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;31m# n = n - 1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.10/dist-packages/ipykernel/iostream.py\u001b[0m in \u001b[0;36mwrite\u001b[0;34m(self, string)\u001b[0m\n\u001b[1;32m 400\u001b[0m \u001b[0mis_child\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_is_master_process\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 401\u001b[0m \u001b[0;31m# only touch the buffer in the IO thread to avoid races\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 402\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpub_thread\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mschedule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mlambda\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_buffer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstring\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 403\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mis_child\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 404\u001b[0m \u001b[0;31m# mp.Pool cannot be trusted to flush promptly (or ever),\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.10/dist-packages/ipykernel/iostream.py\u001b[0m in \u001b[0;36mschedule\u001b[0;34m(self, f)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_events\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;31m# wake event thread (message content is ignored)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_event_pipe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.10/dist-packages/zmq/sugar/socket.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, data, flags, copy, track, routing_id, group)\u001b[0m\n\u001b[1;32m 616\u001b[0m )\n\u001b[1;32m 617\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgroup\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgroup\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 618\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrack\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtrack\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 619\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 620\u001b[0m def send_multipart(\n","\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.send\u001b[0;34m()\u001b[0m\n","\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.send\u001b[0;34m()\u001b[0m\n","\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket._send_copy\u001b[0;34m()\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.10/dist-packages/zmq/backend/cython/checkrc.pxd\u001b[0m in \u001b[0;36mzmq.backend.cython.checkrc._check_rc\u001b[0;34m()\u001b[0m\n","\u001b[0;31mKeyboardInterrupt\u001b[0m: "]}],"source":["n = 5\n","while n:\n"," if n % 2 == 1:\n"," print(n, end='\\t')\n"," # n = n - 1"]},{"cell_type":"markdown","metadata":{"id":"f_aLYDlN1QHu"},"source":["\n","\n","
\n","\n","# 4 Interrupting Loops: `break` and `continue`\n","\n","Python provides two keywords `break` and `continue` that terminate a loop prematurely:\n"]},{"cell_type":"markdown","metadata":{"id":"0rRygy8v1QHv"},"source":["\n","
\n","while <condition>:  \n","        
statement(s)\n"," \n"," if <condition>: # execution steps into the block containing continue or break if True \n"," statement(s)\n"," continue or break \n"," \n"," statement(s) # skipped over if continue or break is reached
\n","following statement(s)
\n","\n"]},{"cell_type":"markdown","metadata":{"id":"kJ9uTIQ81QHw"},"source":["\n","- The `break` and `continue` statements are usually further nested in an `if` test to take action in response to some ``.\n","\n"," - The `continue` statement terminates the ***current*** iteration immediately.\n"," \n"," - The `break` statement immediately terminates a loop ***entirely***."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"xpeXvRCP1QHw"},"outputs":[],"source":["gradebook = [95, 92, 89, 100, 71, 67, 59, 82, 75, 29]"]},{"cell_type":"markdown","metadata":{"id":"x7UeY88xeark"},"source":["How can we get the number of students who have earned scores above 90?\n","- check grades one by one to see the grade is higher than 90\n","- if a grade is higher than 90, we should record that number\n","- if a grade is lower than 90, no need to do anything => maybe a `continue` can be used"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"U0f5NBIA1QHy","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709266414447,"user_tz":-480,"elapsed":332,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"47635908-6bc9-410d-bd13-a8c067159cc5"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(3, 10)"]},"metadata":{},"execution_count":3}],"source":["# find how many students have earned scores above 90 points\n","\n","i = 0\n","count_above = 0\n","\n","while i < len(gradebook):\n"," i += 1\n"," if gradebook[i-1] <= 90: # when a grade is not above 90, we should go to the next iteraction\n"," continue\n"," count_above += 1 # otherwise, we add count_above by 1\n","\n","count_above, i"]},{"cell_type":"markdown","metadata":{"id":"hEbteJn-gXDc"},"source":["** Question**: how to accomplish this task by using `break`?\n","\n","Hint: consider sort the gradebook first\n","\n","- By sorting the gradebook from highest to lowest, we only need to check all grades that are higher than 90\n","\n","- It means we do not need to check all grades, as long as the currect grade is lower than 90, we can leave the loop==> a `break` might be needed"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"zbf67I931QH6","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709266563726,"user_tz":-480,"elapsed":319,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3b9ec26d-a8d8-4212-f491-c0a1fec56ae9"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[100, 95, 92, 89, 82, 75, 71, 67, 59, 29]"]},"metadata":{},"execution_count":4}],"source":["gradebook_sorted = sorted(gradebook, reverse=True)\n","gradebook_sorted"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"IZejEOCh1QIA","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709266610740,"user_tz":-480,"elapsed":310,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"77210633-b595-46c6-f081-9bec36f40464"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(3, 4)"]},"metadata":{},"execution_count":5}],"source":["i = 0\n","count_above = 0\n","\n","while i < len(gradebook_sorted):\n"," i += 1\n"," if gradebook_sorted[i-1] <= 90:\n"," break\n"," count_above += 1\n","\n","count_above, i"]},{"cell_type":"markdown","metadata":{"id":"OtVi3kvPg7TW"},"source":["Compare the value of the counter i when using `continue` and `break` above."]},{"cell_type":"markdown","metadata":{"id":"KDltpy0o1QID"},"source":["- A `break` or `continue` statement in **nested loops** applies to the ***nearest*** enclosing loop.\n","\n","
\n","\n","\n","
\n","while <condition>:  \n","\n","    statement(s)   \n","\n","    while <condition>:\n","        statement(s)  \n","        continue or break              # apply to the inner loop\n","\n","    continue or break                  # apply to the outer loop
\n","\n"]},{"cell_type":"markdown","metadata":{"id":"JlM8WWjxjJHM"},"source":["What if we want to get the number of students in different score ranges 91-100, 81-90, 71-80, 61-70, ..., 11-20, 1-10?"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"hSqkiZCX1QID"},"outputs":[],"source":["gradebook_sorted"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"nGuVkvoVI3aQ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709267043497,"user_tz":-480,"elapsed":290,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"4da166cf-8d78-4cd7-ef14-ec8e47134bca"},"outputs":[{"output_type":"stream","name":"stdout","text":["3 students have earned scores of 91 to 100 points\n","2 students have earned scores of 81 to 90 points\n","2 students have earned scores of 71 to 80 points\n","1 students have earned scores of 61 to 70 points\n","1 students have earned scores of 51 to 60 points\n","0 students have earned scores of 41 to 50 points\n","0 students have earned scores of 31 to 40 points\n","1 students have earned scores of 21 to 30 points\n","0 students have earned scores of 11 to 20 points\n","0 students have earned scores of 1 to 10 points\n"]}],"source":["i = 0\n","threshold = 90\n","\n","while threshold >= 0:\n"," count = 0\n","\n"," while i < len(gradebook_sorted):\n"," if gradebook_sorted[i] <= threshold:\n"," break\n"," count += 1\n"," i += 1\n","\n"," print(f'{count} students have earned scores of {threshold+1} to {threshold+10} points')\n"," threshold -= 10"]},{"cell_type":"markdown","metadata":{"id":"3wYJAE7H1QIW"},"source":["\n","\n","\n","\n","
\n","\n","# 5 Definitive Loops: The `for` Statement\n","\n","\n","A `for` statement allows for looping over sequences, processing them one item at a time.\n","\n","The simple form of a `for` loop is as follows:\n","\n","\n","
\n","\n","
\n","for <variable> in <iterable>:  \n","\n","    statement(s)                 # The break and continue statements also work the same here\n","\n","following statements
\n","\n"," \n","
\n","\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"PX_dL148I3aR","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709267270979,"user_tz":-480,"elapsed":322,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"146b5cb3-4864-4508-f8db-180c99dccbb6"},"outputs":[{"output_type":"stream","name":"stdout","text":["1\t4\t9\t16\t25\t"]}],"source":["for num in [1, 2, 3, 4, 5]:\n"," print(num**2, end='\\t')"]},{"cell_type":"markdown","metadata":{"id":"vSeMeMCZI3aR"},"source":["\n","- When a `for` loop is encountered, execution starts to step through the elements in `` ***in turn***.\n"," \n"," - `statement(s)` often operate on the element which `` currently refers to.\n"," \n"," - When `` is not exhausted, the next element is assigned to `` when control returns to the top.\n","\n","- The loop exits once all elements in `` have been visited.\n","\n","- `` are something capable of returning its members one at a time (or over which we can iterate), including a list, a string, a tuple, a dictionary view, etc."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"EjfkIYt91QIW","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709267458403,"user_tz":-480,"elapsed":372,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3fecab13-4edc-4272-d549-de68ef14385b"},"outputs":[{"output_type":"stream","name":"stdout","text":["P*y*t*h*o*n* *P*r*o*g*r*a*m*m*i*n*g*"]}],"source":["# A string is also an iterable\n","for letter in \"Python Programming\":\n"," print(letter, end='*')"]},{"cell_type":"markdown","metadata":{"id":"gZgXma561QIY"},"source":["Comparing the counter-based `while` loops, `for` loops handle the details of the iteration automatically:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"yDEXIZFg1QIZ"},"outputs":[],"source":["gradebook"]},{"cell_type":"markdown","metadata":{"id":"3L4SmQQLo_-X"},"source":["Previously, we used the `while` loop to count the number of students who have earned scores above 90."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"VGFtFB5HI3aS"},"outputs":[],"source":["i = 0\n","count_above = 0\n","\n","while i < len(gradebook):\n"," i = i + 1\n"," if gradebook[i-1] <= 90:\n"," continue\n"," count_above += 1\n","\n","count_above"]},{"cell_type":"markdown","metadata":{"id":"vqKj5SyKo4je"},"source":["We can achieve the same goal using the `for` loop"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"rlVQ6yWk1QIb","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709267564256,"user_tz":-480,"elapsed":291,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"381fb2ab-644a-4002-cb53-2f830ce293ee"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["3"]},"metadata":{},"execution_count":9}],"source":["count_above = 0\n","\n","for score in gradebook:\n"," if score <= 90:\n"," continue\n"," count_above += 1\n","\n","count_above"]},{"cell_type":"markdown","source":["**Question**: Can you predict the output of the following Python code snippet?\n","```Python\n","numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n","for num in numbers:\n"," if num % 2 == 0:\n"," continue\n"," if num > 5:\n"," break\n"," print(num, end=\" \")\n","```"],"metadata":{"id":"_seRcayAO_re"}},{"cell_type":"markdown","metadata":{"id":"9V_sPhST1QIe"},"source":["\n","- `for` loops can also nest arbitrarily deeply:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"CMM5uqsV1QIf"},"outputs":[],"source":["gradebooks = [[95, 92], [89, 100, 59]]"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"_YIsf8O-1QIj","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268168169,"user_tz":-480,"elapsed":295,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"40ae24ef-de06-4b1f-d712-efafc22f1392"},"outputs":[{"output_type":"stream","name":"stdout","text":["Course 1: 95 92 \n","Course 2: 89 100 59 \n"]}],"source":["i = 1\n","for gradebook in gradebooks:\n"," print(f'Course {i}:', end = ' ')\n"," for score in gradebook:\n"," print(score, end =' ')\n"," i += 1\n"," print(end='\\n')"]},{"cell_type":"markdown","metadata":{"id":"nwLu8shs1QIt"},"source":["\n","\n","
\n","\n","# 6 Loop Coding Techniques\n","\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"Woo_y3iBI3aT"},"source":["\n","## 6.1 Counter-style Traversals with `range()`\n","\n","How can we know the index of a list element?\n","\n","```python\n","records = ['Amy', 1400, 'Yes', False, 'Jane', 1355, 'No', False, 'Brian', 2000, 'Yes', True]\n","```\n","\n","```\n","Amy at position 0\n","Jane at position 4\n","Brian at position 8\n","\n","```\n","\n","\n","\n","To generate indices to iterate through on demand in a `for` loop, we can use [`range()`](https://docs.python.org/3/library/stdtypes.html#range) (the constructor for an immutable sequence of integers) to create a **range** object:\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Z7fOjl1P1QIu","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268322194,"user_tz":-480,"elapsed":281,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"091967ea-b020-484b-b26c-5b21835c31e3"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["range(0, 5)"]},"metadata":{},"execution_count":12}],"source":["range(5)"]},{"cell_type":"markdown","metadata":{"id":"3BiAtrF_1QIx"},"source":["The content of a range object can be displayed by a list call:"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"9PclUvTd1QIy","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268379902,"user_tz":-480,"elapsed":316,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e153692c-92d3-442d-8beb-966357dea1d7"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[0, 1, 2, 3, 4]"]},"metadata":{},"execution_count":13}],"source":["list(range(5)) # start defaults to 0"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"1Tc45o_y1QI4","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268414281,"user_tz":-480,"elapsed":301,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"c634cafc-0a4f-4e31-fa68-d68ca56393b6"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[2, 3, 4, 5, 6]"]},"metadata":{},"execution_count":14}],"source":["list(range(2, 7)) # step defaults to 1"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"-t-dB7ly1QI7","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268474696,"user_tz":-480,"elapsed":328,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"0b3bc9b9-0460-4712-d26e-c4113518806c"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[0, 3, 6]"]},"metadata":{},"execution_count":15}],"source":["list(range(0, 7, 3)) # set step to 3"]},{"cell_type":"markdown","metadata":{"id":"O8eY1AcY1QI_"},"source":["The content is a sequence of integers in arithmetic progression between the start (***inclusive***) and the stop (***exclusive***):\n","\n","$[start, start + step, start+2 \\times step, \\dots, start+i \\times step, \\dots ]$\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"pgZNo28wI3aV","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268538648,"user_tz":-480,"elapsed":313,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"33139696-fdb7-43fc-e549-2ee18cece0bf"},"outputs":[{"output_type":"stream","name":"stdout","text":["0\t1\t2\t3\t4\t"]}],"source":["for i in range(5):\n"," print(i, end = '\\t')"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"PAn6sBvz1QJB","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268646368,"user_tz":-480,"elapsed":292,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"c07b78c4-1754-41f7-e90d-c5834123883d"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Amy at position 0', 'Jane at position 4', 'Brian at position 8']"]},"metadata":{},"execution_count":17}],"source":["records = ['Amy', 1400, 'Yes', False, 'Jane', 1355, 'No', False, 'Brian', 2000, 'Yes', True]\n","output_strings = [f'{records[i]} at position {i}' for i in range(0, len(records), 4)] #list comprehension\n","output_strings"]},{"cell_type":"markdown","metadata":{"id":"-T9s8ydazQ8C"},"source":["\n","\n","**Question**: Can you create a nested list that organizes each customer record with a sublist using list comprehension?\n","\n","```python\n","records = ['Amy', 1400, 'Yes', False, 'Jane', 1355, 'No', False, 'Brian', 2000, 'Yes', True]\n","```\n","\n","\n","```python\n","[['Amy', 1400, 'Yes', False],\n"," ['Jane', 1355, 'No', False],\n"," ['Brian', 2000, 'Yes', True]]\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"GJVj1UY0zTtb","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268862210,"user_tz":-480,"elapsed":302,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"4d4d1189-d4e9-49d4-c477-d55242c90b23"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[['Amy', 1400, 'Yes', False],\n"," ['Jane', 1355, 'No', False],\n"," ['Brian', 2000, 'Yes', True]]"]},"metadata":{},"execution_count":18}],"source":["# write your codes here\n","[[records[i], records[i+1], records[i+2], records[i+3]] for i in range(0, len(records), 4)]"]},{"cell_type":"markdown","metadata":{"id":"tBCNON631QJF"},"source":["
\n","\n","## 6.2 Iterating over Index-value Pairs with **`enumerate()`**\n","\n","The [`enumerate()`](https://docs.python.org/3/library/functions.html#enumerate) funcition provides a simpler way to generate both indices and items for a loop."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"4vzI4VhU1QJF","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268950009,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"870ab9c2-faf6-4d3d-e100-bddfdccd986d"},"outputs":[{"output_type":"execute_result","data":{"text/plain":[""]},"metadata":{},"execution_count":19}],"source":["enum = enumerate('python')\n","enum"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"fYtCZKGs1QJJ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709268969269,"user_tz":-480,"elapsed":329,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"a79025c9-3d97-444b-e5a1-ebbc9a440433"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[(0, 'p'), (1, 'y'), (2, 't'), (3, 'h'), (4, 'o'), (5, 'n')]"]},"metadata":{},"execution_count":20}],"source":["list(enum) # the content can also be displayed by a list call"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"FgKAXHpq1QJM","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269067591,"user_tz":-480,"elapsed":316,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"ff0d3a7f-442a-4a20-d22b-42ad3e7d4253"},"outputs":[{"output_type":"stream","name":"stdout","text":["p appears at position 0\n","y appears at position 1\n","t appears at position 2\n","h appears at position 3\n","o appears at position 4\n","n appears at position 5\n"]}],"source":["for index, item in enumerate('python'):\n"," print(item, 'appears at position', index)"]},{"cell_type":"markdown","metadata":{"id":"DF1S2nzZuksf"},"source":["*Exercise:*\n"," \n","Make use of enumerate() function and list comprehension to find the index of elements starting with \"w\":\n","\n","```python\n","l = ['Python', 'programming', 'language', 'allows', 'the', 'use', 'of', 'a', 'while', 'loop', 'inside', 'another', 'while', 'loop']\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"L---q5zFul2r","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269299275,"user_tz":-480,"elapsed":3,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d0f8ddae-d70e-4814-ce31-9e9c1496f8bf"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[8, 12]"]},"metadata":{},"execution_count":25}],"source":["l = ['Python', 'programming', 'language', 'allows', 'the', 'use', 'of', 'a', 'while', 'loop', 'inside', 'another', 'while', 'loop']\n","# write your codes here\n","[index for index, item in enumerate(l) if item[0] == \"w\"]"]},{"cell_type":"markdown","metadata":{"id":"5X_CzNhm1QJO"},"source":["\n","
\n","\n","## 6.3 Parallel Traversals with **`zip()`**\n","\n","\n","```python\n","names = ['John', 'Danny', 'Tyrion', 'Sam']\n","balances = [20, 10, 5, 40]\n","students = ['Yes', 'No', 'Yes', 'No']\n","outcomes = [False, False, True, True]\n","```\n","\n","```\n","John : False\n","Danny : False\n","Tyrion : True\n","Sam : True\n","```\n","\n"]},{"cell_type":"markdown","metadata":{"id":"G226xGTUJxBu"},"source":["The built-in [`zip()`](https://docs.python.org/3/library/functions.html#zip) function allows us to visit multiple sequences ***in parallel***.\n","\n","\n","`zip()` takes one or more sequences as arguments and returns a series of tuples that pair up parallel items taken from those sequences:\n","\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"3t73kol61QJT","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269498430,"user_tz":-480,"elapsed":339,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"babacf6c-cf61-4434-957f-4aff0a3bda2d"},"outputs":[{"output_type":"execute_result","data":{"text/plain":[""]},"metadata":{},"execution_count":26}],"source":["names = ['John', 'Danny', 'Tyrion', 'Sam']\n","balances = [20, 10, 5, 40]\n","students = ['Yes', 'No', 'Yes', 'No']\n","outcomes = [False, False, True, True]\n","\n","zipped = zip(names, balances, students, outcomes)\n","zipped"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ZY6trgg_1QJX","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269507168,"user_tz":-480,"elapsed":308,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"8a8a734f-9309-4378-9127-ff2dfcd8f6aa"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[('John', 20, 'Yes', False),\n"," ('Danny', 10, 'No', False),\n"," ('Tyrion', 5, 'Yes', True),\n"," ('Sam', 40, 'No', True)]"]},"metadata":{},"execution_count":27}],"source":["list(zipped)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"3DKcQncQO7Rf","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269568689,"user_tz":-480,"elapsed":382,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"38770234-bc20-4cc5-b027-ab65159b4ad5"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[('John', 20, 'Yes', False),\n"," ('Danny', 10, 'No', False),\n"," ('Tyrion', 5, 'Yes', True),\n"," ('Sam', 40, 'No', True)]"]},"metadata":{},"execution_count":28}],"source":["[*zip(names, balances, students, outcomes)] #* is an unpacking operator"]},{"cell_type":"markdown","metadata":{"id":"cUQnhp9I1QJZ"},"source":["Now, we can step over elements from multiple lists within a single comprehension:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"QmyoOOqy1QJb","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269672005,"user_tz":-480,"elapsed":303,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"5a3674d3-6147-42d9-c46b-f6a178a2b11e"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['John: False', 'Danny: False', 'Tyrion: True', 'Sam: True']"]},"metadata":{},"execution_count":29}],"source":["[f'{name}: {outcome}' for name, *others, outcome in zip(names, balances, students, outcomes)] # use sequence unpacking"]},{"cell_type":"code","source":["[f'{name}: {outcome}' for name, outcome in zip(names, outcomes)]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"gZteX0RSaZXU","executionInfo":{"status":"ok","timestamp":1709269705957,"user_tz":-480,"elapsed":305,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"a27d5ff4-e8a6-406b-eada-17a6ccd9ccf7"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['John: False', 'Danny: False', 'Tyrion: True', 'Sam: True']"]},"metadata":{},"execution_count":30}]},{"cell_type":"markdown","metadata":{"id":"w9O-uH7J1QJh"},"source":["`zip()` truncates results at the length of the shortest sequence when the argument lengths differ:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"k5-0efOA1QJi","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269764912,"user_tz":-480,"elapsed":286,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fc4ae748-bb9f-4b29-a148-89ab37cacb39"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[('a', 'x'), ('b', 'y'), ('c', 'z')]"]},"metadata":{},"execution_count":31}],"source":["list(zip('abc', 'xyz123'))"]},{"cell_type":"markdown","metadata":{"id":"8MP3aMuMQMlL"},"source":["\n","**Question**: Can you extract the scores below into a new collection without using a comprehension?\n","\n","```python\n","gradebook = [['Alice', 95], ['Troy', 92], ['James', 89], ['Charles', 100], ['Bryn', 59]]\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"iobgwxK3PArB","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709269980284,"user_tz":-480,"elapsed":398,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"85984718-ce00-4dba-c364-ee5deb81ab51"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(95, 92, 89, 100, 59)"]},"metadata":{},"execution_count":34}],"source":["gradebook = [['Alice', 95], ['Troy', 92], ['James', 89], ['Charles', 100], ['Bryn', 59]]\n","# write your codes here\n","list(zip(*gradebook))[1]"]},{"cell_type":"markdown","metadata":{"id":"X8ExSsBU1QJw"},"source":["\n","
\n","\n","## (Optional) 6.4 Nested Comprehension"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"YheQtAh4I3ab"},"outputs":[],"source":["gradebooks = [[['Alice', 95], ['Troy', 92]], [['James', 89], ['Charles', 100], ['Bryn', 59]]]"]},{"cell_type":"markdown","metadata":{"id":"4RNnEZdE1QKE"},"source":["To pull out data on scores only, we can code ***nested*** loops, each removing one level of nesting:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ckdva-CL1QKF","scrolled":true},"outputs":[],"source":["[score for course in gradebooks for name, score in course]\n","# sequence unpacking is also used here; so we only need a 2-level loop to remove 3 levels of nesting"]},{"cell_type":"markdown","metadata":{"id":"vIb9SWk81QKH"},"source":["The general structure of comprehensions looks like this:\n","\n","
[ expression for target_1 in iterable_1 [if <condition_1>]\n","             for target_2 in iterable_2 [if <condition_2>] ...\n","             for target_N in iterable_N [if <condition_N>] ]
\n"," \n"," \n","We can nest a comprehension in the output expression to retain the existing nesting and produce grouped data: "]},{"cell_type":"code","execution_count":null,"metadata":{"id":"pyu9Wzj71QKI"},"outputs":[],"source":["[[score for name, score in course] for course in gradebooks]"]},{"cell_type":"markdown","metadata":{"id":"NjDit7qC1QKK"},"source":["Sublists produced by the inner comprehension can be further fed into some aggregation functions, like `max()`, `sum()`, etc., to yield group statistics:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"7amz5Hb31QKL"},"outputs":[],"source":["[max([score for name, score in course]) for course in gradebooks]"]},{"cell_type":"markdown","metadata":{"id":"URmKgSzDHh2n"},"source":["\n","**Question**: Write a comprehension to calculate the number of students who earned scores above 90 for each course.\n","\n","```python\n","gradebooks = [[['Alice', 95], ['Troy', 92]], [['James', 89], ['Charles', 100], ['Bryn', 59]]]\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Zfdd7uiZIJMi"},"outputs":[],"source":["# write your code here"]},{"cell_type":"markdown","metadata":{"id":"CVQzZFdXINGC"},"source":["\n","**Question**: Write code to generate all pairs of students from the list below.\n","\n","```python\n","students = ['Alice', 'Troy', 'James', 'Charles', 'Bryn']\n","```\n","\n","The expected output is as follows:\n","\n","```\n","[('Alice', 'Troy'),\n"," ('Alice', 'James'),\n"," ('Alice', 'Charles'),\n"," ('Alice', 'Bryn'),\n"," ('Troy', 'James'),\n"," ('Troy', 'Charles'),\n"," ('Troy', 'Bryn'),\n"," ('James', 'Charles'),\n"," ('James', 'Bryn'),\n"," ('Charles', 'Bryn')]\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"2e1PDNSiWQCH"},"outputs":[],"source":["# write your codes here\n","students = ['Alice', 'Troy', 'James', 'Charles', 'Bryn']\n"]},{"cell_type":"markdown","metadata":{"id":"viCjWLz0I3ac"},"source":["---\n","\n","
\n","\n","# 7 Exception Handling: The `try` Statement\n","\n","\n","Even if a statement or expression is syntactically correct, it may cause an error/exception:\n"]},{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"IsqFrE4tI3ac","outputId":"2daf32db-828c-4a5d-c62e-2d9e35adafab","executionInfo":{"status":"error","timestamp":1709540726388,"user_tz":-480,"elapsed":4,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"ZeroDivisionError","evalue":"division by zero","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m10\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mZeroDivisionError\u001b[0m: division by zero"]}],"source":["10 * (1/0)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"-f_s6kHRI3ad","outputId":"f80cdf97-121a-49aa-d087-589863847f20","executionInfo":{"status":"error","timestamp":1709270161906,"user_tz":-480,"elapsed":369,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"NameError","evalue":"name 'spam' is not defined","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m4\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mspam\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mNameError\u001b[0m: name 'spam' is not defined"]}],"source":["4 + spam * 3"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"ci8IDiySI3ad","outputId":"e90e2f06-bb06-4b22-ae0e-4a508babec01","executionInfo":{"status":"error","timestamp":1709270176587,"user_tz":-480,"elapsed":300,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"TypeError","evalue":"can only concatenate str (not \"int\") to str","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m'2'\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str"]}],"source":["'2' + 2"]},{"cell_type":"markdown","metadata":{"id":"MNPBZZzeI99Y"},"source":["What do we want to happen when these errors occur? Should the program simply crash?\n","\n","No, we want it to gracefully handle these exceptions."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"zSq31GeDI-bS","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709270281975,"user_tz":-480,"elapsed":294,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"49015dff-68d4-461c-abef-599673d7d244"},"outputs":[{"output_type":"stream","name":"stdout","text":["Don't use 0 as the divisor!\n"]}],"source":["try:\n"," 10 * (1/0)\n","except ZeroDivisionError:\n"," print(\"Don't use 0 as the divisor!\")"]},{"cell_type":"markdown","metadata":{"id":"NBN-2LsFI3ad"},"source":["\n","\n","Here is a code skeleton that shows the full potential of the `try` statement:\n","\n","
\n","try:\n","   statement(s)         \n","\n","except <Type 1 Error>:\n","   statement(s)\n","   \n","   ...\n","\n","except <Type n Error>:\n","   statement(s)   \n","   \n","else:\n","   statement(s)      \n","\n","finally:                      # All clause headers are all at the same indentation level.\n","   statement(s)\n","\n","following statement(s)\n","
\n","\n","
\n","\n","- An arbitrary number of `except` clauses can be specified under the `try` clause to handle different exceptions, e.g., `RuntimeError`, `TypeError`, `NameError`, etc.\n","\n","\n","- If no exception occurs in the `try` clause, all the following `except` clauses are skipped.\n","\n","- If an exception occurs in the `try` clause, the rest of the `try` clause is skipped. Then\n","\n"," - If the exception type is matched by an `except` clause, that clause is executed and then execution continues after the `try` statement.\n"," \n"," - If an exception occurs with no match in the following `except` clauses, execution is stopped and we get the standard error.\n","\n","- In effect, at most one handler will be executed. An `except` clause may name multiple exceptions as a parenthesized tuple, for example: `except (RuntimeError, TypeError, NameError): `\n","\n","- The `try` statement has an optional `else` clause, which must follow all `except` clauses and is executed only when the `try` clause does not raise an exception.\n","\n","- The `try` statement supports another optional `finally` clause, which is intended to define clean-up actions that must be executed under all circumstances, such as closing a file or releasing a lock, regardless of whether an exception was raised or not.\n","\n"]},{"cell_type":"code","execution_count":2,"metadata":{"id":"dxngkyfGWQCI","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709542229865,"user_tz":-480,"elapsed":541,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"140680fd-5e4e-4248-b030-4adfd7a8b11d"},"outputs":[{"output_type":"stream","name":"stdout","text":["division by zero\n","unsupported operand type(s) for /: 'str' and 'int'\n","2.5\n","4.0\n","list index out of range\n"]}],"source":["lst = [1, 'text', 5, 12]\n","for i in range(5):\n"," try:\n"," print(lst[i] / i)\n"," except (TypeError, ZeroDivisionError) as error1: # you can give a name to the captured error using the as keyword\n"," print(error1)\n"," except IndexError as error2:\n"," print(error2)"]},{"cell_type":"code","execution_count":3,"metadata":{"id":"TqXPYq7EWQCJ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709542438834,"user_tz":-480,"elapsed":35799,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"dfc3514d-de64-4c34-a98b-dcd1a145bfbe"},"outputs":[{"output_type":"stream","name":"stdout","text":["Please enter an integer: 1.3\n","Oops! That was not a valid integer.\n","Please try again...\n","Please enter an integer: 5.8\n","Oops! That was not a valid integer.\n","Please try again...\n","Please enter an integer: 10\n","What you input is 10!\n","Done!\n"]}],"source":["while True:\n"," try:\n"," x = int(input(\"Please enter an integer: \"))\n"," except ValueError:\n"," print(\"Oops! That was not a valid integer.\")\n"," print(\"Please try again...\")\n"," else: # execute when the try clause does not raise an exception.\n"," print(f\"What you input is {x}!\")\n"," print(\"Done!\")\n"," break"]},{"cell_type":"markdown","metadata":{"id":"k1JnkTL1WQCJ"},"source":["Below are some common types of `Error`s in python:\n","\n","|Type|\tDescription| Example|\n","|:-- |:-- | :-- |\n","|`AttributeError`| Raised on the attribute assignment or reference fails. | `a_tuple = 1, 2, 3`
`a_tuple.sort()`|\n","|`ImportError`| Raised when the import statement has troubles trying to load a module. | `import panda` |\n","|`IndexError`|Raised when the index of a sequence is out of range.| `numbers = [1, 2, 3, 4]`
`numbers[6]`|\n","|`NameError`| Raised when a variable is not found in the local or global scope. | `course = \"ISOM3400\"`
`print(corse)` |\n","|`TypeError`| Raised when a function or operation is applied to an object of an incorrect type. | `3 + '0.4' `|\n","|`ValueError`|Raised when a function gets an argument of correct type but improper value.|`int('I have $3.8 in my pocket')` |\n","|`ZeroDivisionError`|Raised when the second operand of a division or module operation is zero.| `5 / 0`|\n","\n","\n","\n","Please refer to this [Web page](https://docs.python.org/3/library/exceptions.html) for a full list of built-in exceptions in Python."]},{"cell_type":"markdown","metadata":{"id":"Ka9oT09s1QKN"},"source":["---\n","\n","
\n","\n","# Appendix: Python Statements\n","\n","\n","\n","\n","|Statement|Role|Example\n","|:-- |:-- |:-- |\n","|Assignment: `=`|Creating and assigning references|`a, b = 'good', 'bad'`
`ls = [1, 5]; ls[1] = 2; ls[2:2] = [3, 4]` |\n","|Augmented assignment:
`+=`, `-=`, `*=`, `/=`, `%=`, etc.| Combining a binary operation and
an assignment statement|`a *= 2`
`a += b` |\n","|`del`|Deleting references|`del variable`
`del object.attribute`
`del data[index]`
`del data[index:index]`|\n","|`if/elif/else`| Selecting actions|`if \"python\":`
    `print(\"programming\")` |\n","|`for`| Definite loops |`for x in \"python\":`
     `print(x)` |\n","|`while`| Indefinite/general loops |`while x > 0:`
        `print(\"positive\")` |\n","|`break`| Loop exit |`while True:`
        `if exittest(): break` |\n","|`continue`| Loop continue |`while True:`
        `if skiptest(): continue` |\n","|`try/except/finally`| Catching exceptions |`try:`
        `action()`
`except:`
        `print('action error')` |\n"," \n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"F_c1SJi1WQCJ"},"outputs":[],"source":[]}],"metadata":{"colab":{"provenance":[],"toc_visible":true},"hide_input":false,"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.7.13"},"toc":{"base_numbering":1,"nav_menu":{},"number_sections":false,"sideBar":true,"skip_h1_title":false,"title_cell":"Table of Contents","title_sidebar":"Contents","toc_cell":false,"toc_position":{},"toc_section_display":true,"toc_window_display":false}},"nbformat":4,"nbformat_minor":0} \ No newline at end of file diff --git a/course_materials/Topic_4_Functions_and_Classes_(with answers).ipynb b/course_materials/Topic_4_Functions_and_Classes_(with answers).ipynb new file mode 100644 index 0000000..f9affbd --- /dev/null +++ b/course_materials/Topic_4_Functions_and_Classes_(with answers).ipynb @@ -0,0 +1 @@ +{"cells":[{"cell_type":"markdown","metadata":{"id":"LZRm-tkN4vyA"},"source":["\n","# 1 Functions\n","\n","For a bank to consider whether or not to offer someone a loan:\n","\n","\n","\n","\n","\n","| Name | Income | Years | Criminal | Decision |\n","|-----|-----|-----|-----|-----|\n","| Amy | 27 |4.2 | No | ? |\n","| Sam | 32 |1.5 | No | ? |\n","| Jane | 55 | 3.5 | Yes | ? |\n","|...|\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"TzytERd8AiKQ"},"outputs":[],"source":["customer_1 = {'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}"]},{"cell_type":"markdown","metadata":{"cell_style":"split","id":"jgxMndyHAiKb"},"source":["\n"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"eWNutezz4vyD","outputId":"c120c941-61df-40d1-985c-737a97173a18","scrolled":false,"executionInfo":{"status":"ok","timestamp":1709865464653,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["Approve\n"]}],"source":["if customer_1['income'] >= 70:\n"," print('Approve')\n","\n","elif customer_1['income'] >= 30:\n"," if customer_1['years'] >= 2:\n"," print(\"Approve\")\n"," else:\n"," print(\"Reject\")\n","\n","else:\n"," if customer_1['criminal'] == \"No\":\n"," print('Approve')\n"," else:\n"," print('Reject')"]},{"cell_type":"markdown","metadata":{"id":"nDQYB9924vyF"},"source":["What if we want to make a decsion for a different customer, say `customer_2`:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"OcDbDCLE4vyG"},"outputs":[],"source":["customer_2 = {'name': 'Sam', 'income': 32, 'years': 1.5, 'criminal': 'Yes'}"]},{"cell_type":"markdown","metadata":{"cell_style":"split","id":"Ss-Syjt74vyH"},"source":["- Copy and paste this block of code;\n","\n","- Change every `customer_1` to `customer_2` and execute the code again."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"6phOIAQv4vyI","outputId":"c5339eeb-4048-4dac-8b7a-19eaa4303b4f","executionInfo":{"status":"ok","timestamp":1709865493917,"user_tz":-480,"elapsed":316,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["Reject\n"]}],"source":["if customer_2['income'] >= 70:\n"," print('Approve')\n","\n","elif customer_2['income'] >= 30:\n"," if customer_2['years'] >= 2:\n"," print(\"Approve\")\n"," else:\n"," print(\"Reject\")\n","\n","else:\n"," if customer_2['criminal'] == \"No\":\n"," print('Approve')\n"," else:\n"," print('Reject')"]},{"cell_type":"markdown","metadata":{"id":"gwix827d4vyK"},"source":["There is a chance of making incidental mistakes.\n","\n","We should consider writing a function whenever we've copied and pasted a block of code more than once.\n","\n","---\n","\n","
\n","\n","Python provides a number of important **built-in functions** as we've seen, e.g., `type()`, `str()`, `sum()`, `len()`, etc.\n","\n","A function is a named sequence of statements that:\n","\n","- takes input\n","- does something with that input\n","- and, in many cases, also returns the result\n","\n","\n","User-defined functions are needed when we want to automate certain tasks that we have to repeat over and over, often ***with varying inputs***.\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n"," "]},{"cell_type":"markdown","metadata":{"id":"WVpgUtvIp2_P"},"source":["\n","\n","## 1.1 Defining a Function\n","\n","\n","[The `def` statement](https://docs.python.org/3.7/reference/compound_stmts.html#function-definitions) creates a function object and assigns it to a name."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"BbgTmQvBAiLl"},"outputs":[],"source":["def add_1(a, b):\n"," '''implement an addition operation''' # this is the functions' docstring. We will explain it later.\n","\n"," c = a + b\n"," return c"]},{"cell_type":"markdown","metadata":{"cell_style":"split","id":"WoXX_UKyAiLu"},"source":[""]},{"cell_type":"code","execution_count":null,"metadata":{"id":"QdEqI-axpwvL","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709865814772,"user_tz":-480,"elapsed":310,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"a9b496af-4a14-48a6-8c63-6a55598ba8f2"},"outputs":[{"output_type":"stream","name":"stdout","text":["['In', 'Out', '_', '__', '___', '__builtin__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_dh', '_i', '_i1', '_i2', '_i3', '_i4', '_i5', '_i6', '_i7', '_ih', '_ii', '_iii', '_oh', 'add_1', 'customer_1', 'customer_2', 'exit', 'get_ipython', 'quit']\n"]}],"source":["print(dir())"]},{"cell_type":"markdown","metadata":{"id":"ylXgeo64p2_Q"},"source":["The `def` statement consists of a header line (starting with the `def` keyword) followed by a block of statements:"]},{"cell_type":"markdown","metadata":{"id":"h5blFhWiAiL3"},"source":["
\n","def <function name>(<parameter 1>, <parameter 2>, ...):\n","    '''documentation string that can span multiple lines'''\n","    \n","
statement 1 \n"," statement 2 \n"," ...\n"," statement N\n"," return <object>
"]},{"cell_type":"markdown","metadata":{"id":"lC8nkMnkAiL7"},"source":["

\n","\n","\n","- The `def` header line specifies a function name that is assigned the function object, along with a list of zero or more parameters (separated by comma) in parentheses `()` .\n"," \n"," - Like a variable name, a function name is used to refer to the function later.\n"," \n"," - The function parameters are a special kind of variables that refer to objects provided as input to the function ***at the point of call***.\n"," \n"," "]},{"cell_type":"code","execution_count":null,"metadata":{"id":"joqQEo50AiL-","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709865996275,"user_tz":-480,"elapsed":331,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"62c87586-9840-454d-f8b2-fbb70eff13a5"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["21"]},"metadata":{},"execution_count":8}],"source":["add_1(a = 10, b = 11)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"center","id":"du9_S9cKAiMP","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709866003584,"user_tz":-480,"elapsed":299,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"58fa335a-c0a2-449a-a472-30e7aab15b8e"},"outputs":[{"output_type":"stream","name":"stdout","text":["Help on function add_1 in module __main__:\n","\n","add_1(a, b)\n"," implement an addition operation\n","\n"]}],"source":["help(add_1)"]},{"cell_type":"markdown","metadata":{"id":"ElBi-HFh4vyR"},"source":["- Following a colon (`:`), everything that starts at the next line and is ***indented*** thereafter is the **function body**.\n","\n","\n","- Function bodies often contain an ***optional*** [`return` statement](https://docs.python.org/3.7/reference/simple_stmts.html#the-return-statement). `return` triggers the function to return the specified object.\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"qKwe9H3ql28u"},"source":["*Exercise:* Define a functin called `which_is_bigger`, which takes two numbers as input, and return the larger one. Try to use a single line of code for the function body (without using any built-in functions)."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ienq0bjcl5Xi","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709866327558,"user_tz":-480,"elapsed":279,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3d4fc0ae-a86f-4359-bcca-60a342400555"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["100"]},"metadata":{},"execution_count":12}],"source":["# write your code here\n","def which_is_bigger(m,n):\n"," return m if m>=n else n\n","\n","which_is_bigger(100, 20)"]},{"cell_type":"markdown","metadata":{"id":"NpaNGWHN4vyZ"},"source":["\n","
\n","\n","## 1.2 Calling a Function\n","\n","\n","To run a function's body, we use the function's name followed by `()` to *call*/*invoke the function*.\n","\n"," - If any parameters were specified in the function definition, the function call should also send objects as inputs (known as the *arguments*) that match the parameters:\n","\n","

"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"gy0n2bI24vya"},"outputs":[],"source":["add_1(2, 4) # positional matching"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"WmF4nlTJ4vyb"},"outputs":[],"source":["add_1(b=100, a=5.0) # matching by name"]},{"cell_type":"markdown","metadata":{"id":"dzPhkIyH4vyd"},"source":["- The **parameters** are a property of the function, whereas the **arguments** can vary each time we call the function.\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"-YPJQBxbp2_U"},"outputs":[],"source":["def add_1(a, b):\n"," '''implement an addition operation'''\n","\n"," c = a + b\n"," return c"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"q8VBkufnpwvR","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709866558104,"user_tz":-480,"elapsed":286,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fb53fb93-0e64-466a-d991-e9740c8ed6fd"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["6"]},"metadata":{},"execution_count":14}],"source":["x = add_1(2, 4)\n","x"]},{"cell_type":"markdown","metadata":{"id":"0DfnVD6W4vye"},"source":["\n","\n","\n",""]},{"cell_type":"markdown","metadata":{"id":"rgDtYeGr4vyg"},"source":["\n","\n","- Every time we call a function, Python creates a **local namespace** and populates it with parameter names that refer to arguments provided at the point of call.\n","\n","- All the names assigned when a function runs also live in this local namespace. They will only be accessible inside the function being called.\n","\n","- All the local varialbes exist only while the function runs.\n","\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"Fvky_aPCAiNH","outputId":"dcc9414e-eb85-4556-c4b9-02e4b1e42f8d","executionInfo":{"status":"error","timestamp":1709866756494,"user_tz":-480,"elapsed":316,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"NameError","evalue":"name 'c' is not defined","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mc\u001b[0m \u001b[0;31m# Python reports error when we want to access the parameters inside a function.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mNameError\u001b[0m: name 'c' is not defined"]}],"source":["c # Python reports error when we want to access the parameters inside a function."]},{"cell_type":"markdown","metadata":{"id":"0Sv6J1kWpD3i"},"source":["- Every time we call a function, a new local namespace is created and exists only while the function runs. The local namespace is a mechanism to deal with possible **name collisions**. For example, you may define a variable with a same name in the global namespace. When you reference the variable inside the function, Python looks first in the local namespace (inside the current function).\n","\n","- After a call, the execution returns to the place where the function was called."]},{"cell_type":"markdown","metadata":{"id":"fQ_zREd1o6T3"},"source":["*Question:*\n","\n","Consider the following statements, what will be returned if we call `f(3)`?"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"htxtc_gDoGY_","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709866975560,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9f186652-c885-4341-9b17-dcc20d00ec89"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["10"]},"metadata":{},"execution_count":16}],"source":["# run codes to verify your prediction\n","\n","z = 1\n","\n","def f(x):\n"," def g(y):\n"," return y + z\n"," z = 4\n"," return x + g(x)\n","\n","f(3)"]},{"cell_type":"markdown","metadata":{"id":"aEDICXE74vyi"},"source":["
\n","\n","\n","## 1.3 Specifying Return Values\n","\n","\n","Output which is returned from a function is called a **return value**, which can be defined by [the **`return`** statement](https://docs.python.org/3.7/reference/simple_stmts.html#grammar-token-return-stmt):"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"FJSUPVIh4vyj"},"outputs":[],"source":["def add_2(a, b):\n"," c = a + b"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"iXPdvH5L4vym"},"outputs":[],"source":["result_2 = add_2(2, 4)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"_WQvuMwQpsas","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867098806,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"131bb0e5-ca67-4e1c-9492-ac3e4a3e2392"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["NoneType"]},"metadata":{},"execution_count":19}],"source":["type(result_2)"]},{"cell_type":"markdown","metadata":{"id":"sMZcxJm2p2_W"},"source":["What was returned is `None`, which is a special value ***which means \"nothing\"***.\n","\n","Compare `add_2` with `add_3`"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"U1-Vdrxh4vys"},"outputs":[],"source":["def add_3(a, b):\n"," return a + b"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"0qsFvsuo4vyu","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867151581,"user_tz":-480,"elapsed":3,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"8b3c6380-7e41-45f6-e93b-7770b958462c"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["6"]},"metadata":{},"execution_count":22}],"source":["result_3 = add_3(2, 4)\n","result_3"]},{"cell_type":"markdown","metadata":{"id":"Ig8TR_Uz4vyy"},"source":["A function can only have a ***single*** return value, which can be a **compound object**:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"lQGm4yQi4vyz"},"outputs":[],"source":["def divide(dividend, divisor): # our own way to implement divmod()\n"," quotient = dividend // divisor # floor division\n"," remainder = dividend % divisor # modulo operator (remainder)\n"," return (quotient, remainder)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"qJfMjyjK4vy1","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867231303,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"c04d6a72-d4a7-459e-d8b8-41fe6ddc8156"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(8, 3)"]},"metadata":{},"execution_count":24}],"source":["divide(35, 4)"]},{"cell_type":"markdown","metadata":{"id":"THs8LwJI4vzA"},"source":["
\n","\n","\n","We can specify more than one `return` statement within a function. When a `return` statement is reached, the flow of control exits the function immediately:\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"seo3-oiK4vzB"},"outputs":[],"source":["def divide(dividend, divisor):\n"," if not divisor:\n"," print('The divisor cannot be zero!')\n"," return None # None can be dropped here\n","\n"," quotient = dividend // divisor\n"," remainder = dividend % divisor\n"," return quotient, remainder"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"oxQV6aqk4vzC","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867361185,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"6cbac313-942f-49ab-a9a0-75abad7d19b5"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(5, 3)"]},"metadata":{},"execution_count":26}],"source":["divide(28, 5)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"_U1-gStvp2_Y","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867373164,"user_tz":-480,"elapsed":296,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"5dfa2c1f-9908-4cd2-c9ab-d62fce2fe40b"},"outputs":[{"output_type":"stream","name":"stdout","text":["The divisor cannot be zero!\n"]}],"source":["divide(28, 0)"]},{"cell_type":"markdown","metadata":{"id":"RtEd9m1Z4vzE"},"source":["
\n","\n","Now you mostly know the steps of creating a fucntion. The basic idea is extracting repeated code out into a function provides us a more powerful and general way than copying and pasting.\n","\n","Let's use a function `apply_loan` to accomplish a task. Then we call the function `apply_loan` with `customer_1` and `customer_2`, respectively. `apply_loan(customer1)` prints 'Approve' and `apply_loan(customer2)` prints 'Reject'"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"KmIZ5rsOPKoE"},"outputs":[],"source":["customer_1 = {'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}\n","customer_2 = {'name': 'Sam', 'income': 32, 'years': 1.5, 'criminal': 'No'}\n","\n","# write your code here\n","def apply_loan(customer):\n"," if customer['income'] >= 70:\n"," print('Approve')\n","\n"," elif customer['income'] >= 30:\n"," if customer['years'] >= 2:\n"," print(\"Approve\")\n"," else:\n"," print(\"Reject\")\n","\n"," else:\n"," if customer['criminal'] == \"No\":\n"," print('Approve')\n"," else:\n"," print('Reject')"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"uCcBeBuM4vzI","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867714073,"user_tz":-480,"elapsed":287,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"8415e155-9c23-426c-e7c2-d87dded06387"},"outputs":[{"output_type":"stream","name":"stdout","text":["Approve\n"]}],"source":["apply_loan(customer_1) # print Approve"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"QgvA-V-m4vzK","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867734940,"user_tz":-480,"elapsed":321,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"50a6ac30-2d52-4611-8404-8cfd24013252"},"outputs":[{"output_type":"stream","name":"stdout","text":["Reject\n"]}],"source":["apply_loan(customer_2) # print Reject"]},{"cell_type":"markdown","metadata":{"id":"euHm8bBp4vzO"},"source":["\n","
\n","\n","\n","## 1.4 Argument Passing\n","\n","\n","\n","Arguments are passed by assigning **object references** to **local names** during a call. It is another instance of Python assignment at work.\n","\n","\n","\n","During argument passing, two matching schemes determine how the argument objects in the call are paired with parameter names in the header.\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"AXRhZVKhAiOw"},"source":["\n","\n","### 1.4.1 Positional Matching (more frequently used)\n","\n","By default, argument objects get assigned to the parameter names ***according to their position***.\n","\n","For example, consider the function that finds the roots of a quadratic equation:\n","\n","$$\n","ax^2+bx+c=0\n","$$"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ZwIifFOR4vzQ"},"outputs":[],"source":["def quad_1(a, b, c):\n"," x1 = -b / (2 * a)\n"," x2 = (b ** 2 - 4 * a * c) ** 0.5 / (2 * a)\n"," return x1 + x2, x1 - x2"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"KOSP2bER4vzS","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709867981468,"user_tz":-480,"elapsed":337,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"97878a81-5e58-4b43-ee4b-6d07a2290136"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(-1.0, -2.0)"]},"metadata":{},"execution_count":32}],"source":["quad_1(1, 3, 2)"]},{"cell_type":"markdown","metadata":{"id":"Bvpj4qwm4vzV"},"source":["\n","\n","
\n","\n","### 1.4.2 Keyword Matching (used mostly when there are many parameters)\n","\n","Python allows us to alter the way of argument matching by specifying matches by name explicitly. The consequent arguments are called **named**/**keyword arguments**:\n","\n","- Arguments are associated with names/keywords for matching parameters during a call.\n","\n","- When we call functions in this way, the order (position) of the arguments can be changed."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"r7i4Q4mm4vzV"},"outputs":[],"source":["quad_1(c=2, a=1, b=3)"]},{"cell_type":"markdown","metadata":{"id":"hM0e7HewQJFD"},"source":["But note some built-in functions do not accept keyword matching, e.g. 'aaabbbb'.index(sub='b',start=0,end=5) reports errors but 'aaabbbb'.index('b',0,5) will work."]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"1pPWPSqZQKeQ","outputId":"8a08a91b-ad8a-471b-c5c2-4ce86ce4cc0b","executionInfo":{"status":"error","timestamp":1709868130271,"user_tz":-480,"elapsed":338,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"TypeError","evalue":"index() takes no keyword arguments","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m'aaabbbb'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msub\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'b'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstart\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mTypeError\u001b[0m: index() takes no keyword arguments"]}],"source":["'aaabbbb'.index(sub='b', start=0, end=5)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"fZwwsgM1QNKV","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709868150873,"user_tz":-480,"elapsed":289,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"0d90b4f3-f412-452f-acf8-76d068603a9b"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["3"]},"metadata":{},"execution_count":34}],"source":["'aaabbbb'.index('b',0,5)"]},{"cell_type":"markdown","metadata":{"id":"xrbbhagr4vzb"},"source":["\n","
\n","\n","### 1.4.3 Mixing the Two Maching Schemes\n","\n","**Positional matching** and **keyword matching** (matching by name) can be mixed during a function call. But arguments using **positional matching** must precede arguments using **keyword matching**."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/","height":106},"id":"ZENy3Wf_4vzb","outputId":"17e541b9-874d-4bb5-da2f-35d260f50d24","executionInfo":{"status":"error","timestamp":1709868226001,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"SyntaxError","evalue":"positional argument follows keyword argument (, line 1)","traceback":["\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m quad_1(1, c=2, 3)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m positional argument follows keyword argument\n"]}],"source":["quad_1(1, c=2, 3)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/","height":141},"id":"yVHj780I4vzc","outputId":"7e08af16-6d16-4948-aadf-01a65c7da71a","scrolled":true,"executionInfo":{"status":"error","timestamp":1709868253689,"user_tz":-480,"elapsed":313,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"TypeError","evalue":"quad_1() got multiple values for argument 'a'","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mquad_1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mb\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mTypeError\u001b[0m: quad_1() got multiple values for argument 'a'"]}],"source":["quad_1(2, b=3, a=1)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"no1DqnumQF6k","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709868324493,"user_tz":-480,"elapsed":327,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"81cc2c5f-9773-451c-b888-d4ae0388eeb7"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(-1.0, -2.0)"]},"metadata":{},"execution_count":37}],"source":["quad_1(1, c=2, b=3)"]},{"cell_type":"markdown","metadata":{"id":"UxY2R41ZSfoA"},"source":["An easy trick: 1. always use positional matching first 2. for later arguments, always use keywords that appear at the back, i.e. not using keywords appear in the front"]},{"cell_type":"markdown","metadata":{"id":"xWm_0yAU4vze"},"source":["\n","
\n","\n","## 1.5 Specifying Parameters\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"Ng9pqgPaCCFv"},"source":["### 1.5.1 Default Parameter Values\n","\n","In a function definition, we can specify a default value for a parameter with the form `parameter=expression`:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"oaLPDcuU4vzf"},"outputs":[],"source":["def quad_2(b, c, a=1.0): # parameters with default values must follow those without default values\n"," x1 = -b / (2 * a)\n"," x2 = (b ** 2 - 4 * a * c) ** 0.5 / (2 * a)\n"," return (x1 + x2), (x1 - x2)"]},{"cell_type":"markdown","metadata":{"id":"t_iIgEXC4vzh"},"source":["For a parameter with a default value, the corresponding argument is ***optional***:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"p9Tmsui_4vzi","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709868497713,"user_tz":-480,"elapsed":336,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9f3fd4ec-4ac5-4b4c-a02d-44c0dc63b142"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(-1.0, -2.0)"]},"metadata":{},"execution_count":39}],"source":["quad_2(3, 2)"]},{"cell_type":"markdown","metadata":{"id":"ZLPMmzJM4vzk"},"source":["The default value can be overriden by providing an argument during a call:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"2FUzfpHS4vzk","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709868536497,"user_tz":-480,"elapsed":286,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"268d95ff-bb1a-4c1e-8d1a-f71389841c83"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(-0.5, -3.0)"]},"metadata":{},"execution_count":40}],"source":["quad_2(7, 3, 2)"]},{"cell_type":"markdown","metadata":{"id":"21FB0nyBrAII"},"source":["*Exercise:* Write a function called `describe_city()` that accepts the name of a city and its country (i.e. two parameters). The function should print a simple sentence, such as \"Miami is in United States\". Give the country parameter a default value.\n","\n","Call your function for three different cities, at least one of which is not in the default country"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"gvWimCIarBPR","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709868829607,"user_tz":-480,"elapsed":293,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fb8b7838-2a9f-4034-f607-2a40d547e0e6"},"outputs":[{"output_type":"stream","name":"stdout","text":["Miami is in United States\n","Beijing is in China\n","Paris is in France\n"]}],"source":["# write your codes here\n","def describe_city(city, country=\"China\"):\n"," print(city, \"is in\", country)\n","\n","describe_city(\"Miami\", \"United States\")\n","describe_city(\"Beijing\")\n","describe_city(\"Paris\", \"France\")"]},{"cell_type":"markdown","metadata":{"id":"mkBTRNlQp3g5"},"source":["> Default arguments are evaluated once at the time of function definition. This may cause problems if the argument is a mutable object such as a list or a dictionary. If the function modifies the object (e.g., by appending an item to a list), the default value is modified. So, **do not use mutable objects as default values** in the function or method definition."]},{"cell_type":"markdown","metadata":{"id":"RbLnc5xhU_dQ"},"source":["Things can be tricky when the default value is a ***mutable*** object and the function body alters the default value.\n","\n","- The reason is that Python computes each default value and saves the reference to it precisely ***once***, when the `def` statement evaluates (rather than each time the function gets called)."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"7sjtYw7wVCvN"},"outputs":[],"source":["def add_to_list(pet, pets=[]):\n"," pets.append(pet)\n"," return pets"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"FM6MwbAwVEHX","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869089034,"user_tz":-480,"elapsed":294,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d311b0b2-bd92-4472-fc33-dcdc4e3a482b"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['cat']"]},"metadata":{},"execution_count":43}],"source":["add_to_list('cat')"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"f6vSBbQBVFZU","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869162347,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"8289dab6-9c9e-46fc-feed-98b4573c4d68"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['cat', 'cat', 'cat', 'cat']"]},"metadata":{},"execution_count":46}],"source":["add_to_list('cat')"]},{"cell_type":"markdown","metadata":{"id":"arUjc7PyVPvp"},"source":["But a function's output should not depend on how many times it has been called (functions should be ***non-stateful***).\n","\n","A better practice could be:\n","\n","We can use the following idiom to create an empty list inside the function body"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"UonD7wwjVe48"},"outputs":[],"source":["def add_to_list(pet, pets=None):\n"," if pets == None:\n"," pets = []\n"," pets.append(pet)\n"," return pets"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"vmzDiiruVfij","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869267209,"user_tz":-480,"elapsed":312,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"6beed270-1ae5-4322-884f-fa9f1792c001"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['cat']"]},"metadata":{},"execution_count":48}],"source":["add_to_list('cat')"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"S3BvcHwrVkR4","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869276730,"user_tz":-480,"elapsed":358,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"8528cbe1-b541-48f7-8aca-229db59c9f6c"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['cat']"]},"metadata":{},"execution_count":51}],"source":["add_to_list('cat')"]},{"cell_type":"markdown","metadata":{"id":"QE6npMl0hy6h"},"source":["### 1.5.2 Allowing for an Arbitrary Number of Arguments\n","\n","\n","Python allows us to pass an arbitrary number of positional or keyword arguments to a function."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"R803NGRuAiQI","outputId":"fc06473c-fae2-42d7-97e0-d7eefdfef901","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709800743987,"user_tz":-480,"elapsed":364,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[2, 3, 4]"]},"metadata":{},"execution_count":55}],"source":["# recall the use of * to gather excess items in sequence unpacking\n","first, *remaining = 1, 2, 3, 4\n","remaining"]},{"cell_type":"markdown","metadata":{"id":"0GtPlI_KAiQL"},"source":["\n","We can put `*` before a parameter to indicate that it can take a ***variable*** sequence of *positional arguments* and pack them ***into a tuple***, which is then assigned to the variable:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"hsb3jLFc4vzt"},"outputs":[],"source":["def mean_v1(*elems): # Positional arguments are packed into a tuple and referenced by elems\n"," print(elems)\n"," if not elems:\n"," return 0\n","\n"," sumOfElems = 0\n"," countOfElems = 0\n","\n"," for elem in elems:\n"," sumOfElems += elem\n"," countOfElems += 1\n","\n"," return sumOfElems / countOfElems"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"FCrdPQl64vzy","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869573977,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"0a66e68c-96b2-4817-89b4-330240e673aa"},"outputs":[{"output_type":"stream","name":"stdout","text":["(1, 2, 3, 4, 5, 6)\n"]},{"output_type":"execute_result","data":{"text/plain":["3.5"]},"metadata":{},"execution_count":54}],"source":["mean_v1(1, 2, 3, 4, 5, 6)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"i9-JdSTwAiQb","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869637990,"user_tz":-480,"elapsed":491,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"bfa39420-b2df-4ead-902b-0bb044c25980"},"outputs":[{"output_type":"stream","name":"stdout","text":["()\n"]},{"output_type":"execute_result","data":{"text/plain":["0"]},"metadata":{},"execution_count":55}],"source":["mean_v1()"]},{"cell_type":"markdown","metadata":{"id":"YqIIaK9fsW_K"},"source":["*Exercise:* Create a function called `greet()` to print greeting messages to arbitrary number of users.\n","\n","For example, by runing\n","```python\n","greet(\"Monica\", \"Luke\", \"Steve\", \"John\")\n","```\n","You should see\n","```\n","Hello Monica\n","Hello Luke\n","Hello Steve\n","Hello John\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"CqWUqRU8sY7s","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709869800549,"user_tz":-480,"elapsed":321,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e55515d0-1f89-45bf-ea37-72124e0ab3ce"},"outputs":[{"output_type":"stream","name":"stdout","text":["Hello Monica\n","Hello Luke\n","Hello Steve\n","Hello John\n"]}],"source":["# write your codes here\n","def greet(*names):\n"," for name in names:\n"," print(\"Hello\", name)\n","\n","greet(\"Monica\", \"Luke\", \"Steve\", \"John\")"]},{"cell_type":"markdown","metadata":{"id":"JMvi5oZUp2_g"},"source":["We `*` operator is used in a call, it unpacks a sequence into individual positional arguments:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Po6IxcL3s0wk","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710140981951,"user_tz":-480,"elapsed":301,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e210cd01-7ee5-478f-93f2-ce25d875d911"},"outputs":[{"output_type":"stream","name":"stdout","text":["1 2 3 4 5 6\n"]}],"source":["print(1, 2, 3, 4, 5, 6)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"TBi141qup2_g","scrolled":true},"outputs":[],"source":["print(*[1, 2, 3, 4, 5, 6])"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"0TkR8jMP4vz3","scrolled":false},"outputs":[],"source":["listOfNums = [1, 2, 3, 4, 5] # what if we pass in a collection instead of individual elements?\n","mean_v1(*listOfNums)"]},{"cell_type":"markdown","metadata":{"id":"YNEigZau4vz4"},"source":["Note `*` here is used when calling a function rather than when defining a function.\n","\n","`**` is used to indicate that a parameter can take a ***variable*** sequence of *keyword*/*named arguments*, and pack them ***into a dictionary***:\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"boPLmxNJ4vz5"},"outputs":[],"source":["def update_detail(**info):\n"," print(info)\n"," for k, v in info.items():\n"," print(f\"{k} -> {v}\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"PAbGiIGn4vz6","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709801160214,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"1f614add-bee7-42f8-b43b-1a029a60b4c6"},"outputs":[{"output_type":"stream","name":"stdout","text":["{'name': 'Sam', 'id': '1902034', 'grade': 'A+'}\n","name -> Sam\n","id -> 1902034\n","grade -> A+\n"]}],"source":["update_detail(name='Sam', id='1902034', grade=\"A+\")"]},{"cell_type":"markdown","metadata":{"id":"NT7T5Y6Yp2_h"},"source":["Similarly, `**` used in a call unpacks a mapping into individual keyword arguments:"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"A8mhJQ_T4vz8","outputId":"12707626-2ac7-4371-fa1c-28e9760d5bce","scrolled":true,"executionInfo":{"status":"ok","timestamp":1709801195086,"user_tz":-480,"elapsed":494,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["{'name': 'Sam', 'id': '1902034', 'major': 'Business Analytics', 'year': 3}\n","name -> Sam\n","id -> 1902034\n","major -> Business Analytics\n","year -> 3\n"]}],"source":["details = {'name': 'Sam', 'id': '1902034', 'major': 'Business Analytics', 'year': 3}\n","update_detail(**details) # equivalent to update_detail(name='Sam', id='1902034', major='IS', year=3)"]},{"cell_type":"markdown","metadata":{"id":"nZtEYeVZ4vz9"},"source":["\n","
\n","\n","### 1.5.3 Parameter Ordering\n","\n","We can mix ordinary parameters, `*args`, and `**kwargs` in a parameter specification. But they need to occur in a particular order:\n","\n","- `*args` refer to non-keyword arguments, `**kwargs` refers to keyword arguments\n","- Parameters for positional matching (those without default values come first) > `*args` > parameters for keyword matching > `**kwargs`\n","- The presence of the starred parameter `args` enforces everything before it to use positional matching and everything after it to use keyword matching."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"33hIRfA64vz-"},"outputs":[],"source":["def print_all_args(x1, x2='python', *args, y1='business', y2, **kwargs):\n"," print(\"x1 is: \", x1)\n"," print(\"x2 is: \", x2)\n"," print(\"y1 is: \", y1)\n"," print(\"y2 is: \", y2)\n"," print(\"args is: \", args)\n"," print(\"kwargs is: \", kwargs)"]},{"cell_type":"markdown","metadata":{"id":"G8MxeYl64vz_"},"source":["> Keyword arguments are not necessary to have a default value."]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ivO0GZjsp2_i","outputId":"f4eac5e5-8f0a-4e2b-b815-a789a514c3c7","executionInfo":{"status":"ok","timestamp":1710141866215,"user_tz":-480,"elapsed":377,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["x1 is: Ann\n","x2 is: cat\n","y1 is: science\n","y2 is: 2019\n","args is: ('dog', 'pig')\n","kwargs is: {'day': 'Monday', 'date': 'May 6'}\n"]}],"source":["print_all_args('Ann', 'cat', 'dog', 'pig', y1='science', y2='2019', day='Monday', date='May 6')"]},{"cell_type":"code","source":["print_all_args('Ann', y2='2019', y1=\"finance\")"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"JUrlsGTAGtyo","executionInfo":{"status":"ok","timestamp":1710141939975,"user_tz":-480,"elapsed":299,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"c0d7af5f-fd10-40c0-f8cd-b4d7e1ff4ebe"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["x1 is: Ann\n","x2 is: python\n","y1 is: finance\n","y2 is: 2019\n","args is: ()\n","kwargs is: {}\n"]}]},{"cell_type":"markdown","source":["**Question**:\n","\n","Write a function called `sort_letters` that satisfies the following requirements:\n","\n","- It can take a variable sequence of letters;\n","\n","- It supports an option called `order`, which defaults to `None`, returning a list of passed-in letters without changing their order;\n","\n","- If `order` is set to `'asc'`, sort all letters in ascending order in the output;\n","\n","- If `order` is set to `'desc'`, sort all letters in descending order in the output.\n","\n","For example, the expected output of\n","\n","```python\n","sort_letters('e', 'z', 'm', 'i', 'w', order='desc')\n","```\n","is\n","\n","```\n","['z', 'w', 'm', 'i', 'e']\n","\n","```"],"metadata":{"id":"TXNJbK6lHCmY"}},{"cell_type":"code","source":["# write your code here\n","def sort_letters(*letters, order = None):\n"," if not order:\n"," return letters\n"," elif order == 'asc':\n"," return sorted(letters)\n"," elif order == 'desc':\n"," return sorted(letters, reverse=True)\n"," else:\n"," return\n","\n","sort_letters('e', 'z', 'm', 'i', 'w', order='desc')"],"metadata":{"id":"PUnryDFvHIrZ","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710142549839,"user_tz":-480,"elapsed":312,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"cb0b4ab4-838e-42af-9e77-f31dd18cb518"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['z', 'w', 'm', 'i', 'e']"]},"metadata":{},"execution_count":7}]},{"cell_type":"markdown","metadata":{"id":"P9xZCiRNgawS"},"source":["## 1.6 Writing a Function's Docstring\n","\n","A function definition can include a **docstring** (short for **documentation string**) to describe what the function does and how it works.\n","\n","Function docstrings are placed immediately after the function header and between triple quotation marks:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"CmY-u9UKgdab"},"outputs":[],"source":["def mean_v2(*elems):\n"," '''Return the mean of a sequence of values.'''\n"," if not elems: return 0\n"," sumOfElems = 0; countOfElems = 0\n"," for elem in elems:\n"," sumOfElems += elem\n"," countOfElems += 1\n"," return sumOfElems / countOfElems"]},{"cell_type":"markdown","metadata":{"id":"oGUoXljRggE9"},"source":["A function's docstring can be accessed using help():"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"R9bWumz0gidv","outputId":"1884b514-5af5-4d54-e765-3a920c8d7fdc","executionInfo":{"status":"ok","timestamp":1710142696271,"user_tz":-480,"elapsed":293,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["Help on function mean_v2 in module __main__:\n","\n","mean_v2(*elems)\n"," Return the mean of a sequence of values.\n","\n"]}],"source":["help(mean_v2)"]},{"cell_type":"markdown","metadata":{"id":"XC90zdxn4v0j"},"source":["\n","\n","
\n","\n","\n","## 1.7 `lambda` Expressions\n","\n","\n","Besides the `def` statement, Python provides an expression form to generate function objects, known as [`lambda` expressions](https://docs.python.org/3/reference/expressions.html#lambdas).\n","\n","`Lambda`function, also known as anonymous functions, can be considered a degenerate kind of functions, which don't have a name and carry only a ***single*** expression whose result is returned:\n","\n","\n","

\n","lambda <parameter 1>, <parameter 2>, ...: <a single expression using parameters>\n","
"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"UzhYzsPS4v0j"},"outputs":[],"source":["def multiply_v1(x, y=1):\n"," return x * y"]},{"cell_type":"markdown","metadata":{"id":"UHY_Nu2Bpw_Y"},"source":["We can transform the above function to a lambda expression."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"5QRwUNw5AiR4","outputId":"d4c2c593-334d-42ae-8647-605a5ae89d71","scrolled":true,"executionInfo":{"status":"ok","timestamp":1710142934806,"user_tz":-480,"elapsed":295,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["(x, y=1)>"]},"metadata":{},"execution_count":11}],"source":["lambda x, y=1: x * y"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"VXqy75lmp09l","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710142947003,"user_tz":-480,"elapsed":325,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"22f563b4-d85b-4f9b-a662-f3b351c37541"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["function"]},"metadata":{},"execution_count":12}],"source":["type(lambda x, y=1: x * y)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"dCwxQeMQ4v0m"},"outputs":[],"source":["# can be embedded in an assignment statement to create a name for the function object\n","multiply_v2 = lambda x, y=1: x * y"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"5qhsN1MX4v0n","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710143007211,"user_tz":-480,"elapsed":292,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e0949a3c-8d82-43be-d268-1f0d8f8bf0b6"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["3"]},"metadata":{},"execution_count":14}],"source":["multiply_v2(3)"]},{"cell_type":"markdown","metadata":{"id":"p2fqAppFAiR-"},"source":["\n","** Question**: Use `lambda` to implement the following formula:\n","\n","$$\n","f(x) = x^2 + x + 5\n","$$\n","\n","- Assign the resultant function to `f`;\n","\n","- Test the lambda function with the following inputs: `f(4)`, `f(5)` and `f(7)`."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Y96VLfu7AiR_","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710143265497,"user_tz":-480,"elapsed":283,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d8b66f3b-93d9-4e8d-e902-117f25582765"},"outputs":[{"output_type":"stream","name":"stdout","text":["25\n","35\n","61\n"]}],"source":["# write your codes here\n","f = lambda x: x**2 + x + 5\n","print(f(4))\n","print(f(5))\n","print(f(7))"]},{"cell_type":"markdown","metadata":{"id":"Nh0q9vTu4v0q"},"source":["The `lambda` expression is most useful as a shorthand for `def`. It is sometimes used together with other functions taking a function as a parameter.\n","\n","\n","Given a nested list representing a gradebook:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"R1QqtD0G4v0r"},"outputs":[],"source":["gradebook = [['Troy', 92], ['Alice', 95], ['James', 89], ['Charles', 100], ['Bryn', 59]]"]},{"cell_type":"markdown","metadata":{"id":"JYiah2w04v0t"},"source":["If we want to use `sorted()` to implement some sophisticated sorting, we can do so by defining a `lambda` function and passing it into a function call as the argument to `key` (Recall we have used sorted by making `key=int` to compare string numbers)."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"jwPNInmE4v0w","outputId":"0d3b9a9e-9b74-4110-d147-2ba3707d1e19","scrolled":true,"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1709818013432,"user_tz":-480,"elapsed":20,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[['Bryn', 59], ['James', 89], ['Troy', 92], ['Alice', 95], ['Charles', 100]]"]},"metadata":{},"execution_count":14}],"source":["# sort sublists by their second elements\n","sorted(gradebook, key=lambda x: x[1])"]},{"cell_type":"markdown","metadata":{"id":"HYGL-KuVrfC8"},"source":["*Exercise:* What codes you should write if you want to sort students by the first character of their names? Combining the `key` parameter and `lambda` function to do that."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"JTDmUQsZrf8W","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710143797097,"user_tz":-480,"elapsed":286,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"2a0d72ff-c682-4929-e000-e30b44d67da2"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[['Alice', 95], ['Bryn', 59], ['Charles', 100], ['James', 89], ['Troy', 92]]"]},"metadata":{},"execution_count":19}],"source":["# write your codes here\n","sorted(gradebook, key=lambda x: x[0])"]},{"cell_type":"markdown","metadata":{"id":"eGnFlQwjp2_o"},"source":["\n","** Challenging Exercises**:\n","\n","Given a nested list representing gradebooks of different courses:\n","```python\n","gradebooks = [[['Troy', 92], ['Alice', 95]], [['James', 89], ['Charles', 100], ['Bryn', 59]]]\n","```\n","\n","- Using the built-in `sorted()` function, write code to sort courses by course mean. The expected output is\n","\n","```python\n","[[['James', 89], ['Charles', 100], ['Bryn', 59]], [['Troy', 92], ['Alice', 95]]]\n","```\n","\n","Hint:\n","1. the key for the sorted() should be the mean grade for each course.\n","2. the mean grade can be obtained by using list comprehension."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"T_OltNhdsKIU","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710144249490,"user_tz":-480,"elapsed":284,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"08fda590-1d31-4246-fb78-a75305504c1d"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[[['James', 89], ['Charles', 100], ['Bryn', 59]],\n"," [['Troy', 92], ['Alice', 95]]]"]},"metadata":{},"execution_count":20}],"source":["gradebooks = [[['Troy', 92], ['Alice', 95]], [['James', 89], ['Charles', 100], ['Bryn', 59]]]\n","# write your codes here\n","sorted(gradebooks, key=lambda x:sum([score for name, score in x])/len(x))"]},{"cell_type":"code","source":["sorted(gradebooks, key=lambda x:sum(dict(x).values())/len(x))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"0ZmYh3KmirsX","executionInfo":{"status":"ok","timestamp":1710144334094,"user_tz":-480,"elapsed":289,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"413335bd-85cf-4148-b9e0-fd152fb6fefc"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["[[['James', 89], ['Charles', 100], ['Bryn', 59]],\n"," [['Troy', 92], ['Alice', 95]]]"]},"metadata":{},"execution_count":21}]},{"cell_type":"markdown","metadata":{"id":"F3dHOLabsGnf"},"source":["*More challenge:*\n","- Using the builtin `sorted()` function, write code to sort students of each course by score in descending order. The expected output is\n","\n","```python\n","[[['Alice', 95], ['Troy', 92]], [['Charles', 100], ['James', 89], ['Bryn', 59]]]\n","```"]},{"cell_type":"markdown","metadata":{"id":"G3ActxaDgL9g"},"source":["Hint: apply list comprehension to generate a new list, each element of this new list is a sorted list of each course."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"KZWtAMCKp2_o","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710144691850,"user_tz":-480,"elapsed":287,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9fde80ba-edc4-45fe-d46c-ed1db83e111f"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[[['Alice', 95], ['Troy', 92]],\n"," [['Charles', 100], ['James', 89], ['Bryn', 59]]]"]},"metadata":{},"execution_count":22}],"source":["# write your codes here\n","[sorted(course, key=lambda x: x[1], reverse=True) for course in gradebooks]"]},{"cell_type":"markdown","metadata":{"id":"fs4ZxPTx4v1M"},"source":["\n","
\n","\n","# 2 Classes\n","\n","We've seen various types of objects, such as the `int`, `str`, `list`, `tuple`, and `dict`:"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"Gm3nx9QtQFOp","outputId":"bf59d9d0-f246-4c03-cc44-10ceb9808fcd","executionInfo":{"status":"ok","timestamp":1710144847729,"user_tz":-480,"elapsed":312,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["int"]},"metadata":{},"execution_count":23}],"source":["type(1)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"VpikAVMMQFOp","outputId":"012735f2-96a0-4d01-f9e9-aeaa7714b05a","executionInfo":{"status":"ok","timestamp":1710144853656,"user_tz":-480,"elapsed":298,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["str"]},"metadata":{},"execution_count":24}],"source":["type('cat')"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"2AP8XJ2Y4v1M"},"outputs":[],"source":["a = list() # create a list object that is empty\n","b = list('abc') # create a list object that is empty containing 'a', 'b', and 'c'\n","c = tuple('xyz') # create a tuple object containing 'x', 'y', and 'z'\n","d = 'abc'"]},{"cell_type":"markdown","metadata":{"id":"-qJrnjpY4v1O"},"source":["We've seen that the same type of objects share common behaviors realized through methods:"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"TEcKLrgi4v1O"},"outputs":[],"source":["a.append(1)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"EwFFZP-V4v1R"},"outputs":[],"source":["b.append(2)"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"QL_DFjnu4v1S"},"outputs":[],"source":["d.capitalize() # capitalize() method converts the first character of a string to an uppercase letter and all other alphabets to lowercase."]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","id":"E4DftKRO4v1T","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710144997101,"user_tz":-480,"elapsed":447,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9f275bde-a5bd-49a0-a6c6-d365b17a2114"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'Xyz'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":29}],"source":["'xyz'.capitalize()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":141},"id":"QRPx8B5LQFOr","outputId":"7f558b15-02fd-40df-d280-f518f2db4700","executionInfo":{"status":"error","timestamp":1710145018065,"user_tz":-480,"elapsed":464,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"AttributeError","evalue":"'list' object has no attribute 'capitalize'","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcapitalize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute 'capitalize'"]}],"source":["a.capitalize()"]},{"cell_type":"markdown","metadata":{"id":"un42Ul5A4v1U"},"source":["\n","\n","What if we want to create new types of objects that possess certain **properties** and **behaviors** (e.g., customers)?\n","\n","\n","\n","Python provides a coding structure and device known as the *class* to define new types of objects.\n","\n","Just like functions and modules, Python classes are another compartment ***for packaging logic and data***.\n","\n","**Classes** are Python's main ***object-oriented programming*** (OOP) tool.\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"1hA5PnJbxy_i"},"source":["\n","
\n","\n","## 2.1 Defining a Class\n","\n","\n","[The `class` statement](https://docs.python.org/3.7/reference/compound_stmts.html#class-definitions) creates a class object and assigns it a name.\n","\n","The body of a class is where we specify the attributes of the class, including both data and method attributes.\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"umYVV0l54v1U"},"outputs":[],"source":["class Customer: # names for user-defined classes begin with uppercase letters by convention\n"," '''A class for bank customers.'''\n","\n"," def __init__(self, name, income, years, criminal='No'):\n"," '''populate the attributes of a particular customer'''\n"," self.name = name # assignments to attributes of self\n"," self.income = income\n"," self.years = years\n"," self.criminal = criminal\n","\n"," def apply_loan(self): # a function attribute\n"," if self.income >= 70:\n"," result = 'Approve'\n"," elif self.income >= 30:\n"," if self.years >= 2:\n"," result = 'Approve'\n"," else:result = 'Reject'\n"," else:\n"," if self.criminal == \"No\":\n"," result = 'Approve'\n"," else: result = 'Reject'\n"," return result"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":103},"id":"1gRZQClk4zzp","outputId":"5552956b-479f-4d9f-be22-f5bee3ab1445","executionInfo":{"status":"ok","timestamp":1710471425231,"user_tz":-480,"elapsed":444,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["__main__.Customer"],"text/html":["
\n","
Customer
def __init__(name, income, years, criminal='No')
A class for bank customers.
"]},"metadata":{},"execution_count":2}],"source":["Customer"]},{"cell_type":"markdown","metadata":{"id":"Cx1Y4ukC4v1V"},"source":["\n","What a class defininition creates is basically a wrapper around a new namespace. This new namespace is populated with ***all names created by the top-level assignments*** (i.e., `def`s and regular assignments) inside the class definition and several special names automatically created by Python.\n","\n","
\n","\n","\n","\n","\n","\n"]},{"cell_type":"markdown","source":["Because these names exist in that class object rather than the global namespace, they can only be accessed by referencing the class object. That's why they are regarded as the **attributes of the class**, and the dot notation is called the **attribute reference notation** in Python."],"metadata":{"id":"eWSuzOo4OdpS"}},{"cell_type":"code","source":["Customer.apply_loan # class methods are just functions defined inside the class"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":103},"id":"ow9Nj6PnNKhF","executionInfo":{"status":"ok","timestamp":1710471631748,"user_tz":-480,"elapsed":325,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"f6d4b456-8e3a-4b35-9be8-0ef075a11480"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":[""],"text/html":["
\n","
Customer.apply_loan
def apply_loan()
/content/<ipython-input-1-f7fb2dd7b353><no docstring>
"]},"metadata":{},"execution_count":3}]},{"cell_type":"code","source":["Customer.__doc__ # a special attribute of a class that contains the object's docstring"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":35},"id":"0PASqsckNPBK","executionInfo":{"status":"ok","timestamp":1710471639266,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3793294e-a006-4e5a-d036-b651339ddbfb"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["'A class for bank customers.'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":4}]},{"cell_type":"markdown","metadata":{"id":"p-_i4Lus5J95"},"source":["\n","Names in a class's namespace can be exposed by the built-in `__dict__` attribute:"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"eVpmKd905JL2","outputId":"5ba846fb-0812-4194-fc95-8d8f700c9393","executionInfo":{"status":"ok","timestamp":1710471669756,"user_tz":-480,"elapsed":283,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["mappingproxy({'__module__': '__main__',\n"," '__doc__': 'A class for bank customers.',\n"," '__init__': ,\n"," 'apply_loan': ,\n"," '__dict__': ,\n"," '__weakref__': })"]},"metadata":{},"execution_count":5}],"source":["Customer.__dict__"]},{"cell_type":"markdown","metadata":{"id":"fgzVNwt24v1Z"},"source":["\n","
\n","\n","## 2.2 Instantiating a Class\n","\n","A class provides the specification of a user-defined type, and serves as the template from which instances of this type can be created..\n","\n","\n","\n","\n","\n","Calling a **class object** like a function makes a new **instance object**:"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"L7wJRKaN4v1a","outputId":"f4c0276f-a53f-4ca5-e143-8ef183171fe9","executionInfo":{"status":"ok","timestamp":1710745479939,"user_tz":-480,"elapsed":454,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["<__main__.Customer at 0x7a03202197b0>"]},"metadata":{},"execution_count":2}],"source":["customer_1 = Customer(\"Amy\", 27, 4.2)\n","customer_1"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"TFoPOw99AiTL","outputId":"e669f922-975d-409f-ef9f-5980b211fb41","executionInfo":{"status":"ok","timestamp":1710472213597,"user_tz":-480,"elapsed":479,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["<__main__.Customer at 0x7ffa94a7d060>"]},"metadata":{},"execution_count":7}],"source":["customer_2 = Customer(\"Sam\", 32, 1.5, \"Yes\")\n","customer_2"]},{"cell_type":"markdown","metadata":{"id":"je41oq_R4v1f"},"source":["- The instantiation operation first creates an empty **instance** of the class. Let's refer to it as `new_instance`;\n","\n","- Python then invokes `new_instance.__init__(\"Sam\", 32, 1.5, \"Yes\")`\n","to initialize it to a specific **initial state**.\n","
\n","def __init__(self, name, income, years, criminal=\"No\"):\n","     '''populate the attributes of a particular customer'''\n","     \n","     self.name = name\n","     self.income = income\n","     self.years = years\n","     self.criminal = criminal\n","
\n"," \n"," - The 1st parameter (named `self` by convention) is special and used to take the instance from which the corresponding method is being called. \n","\n","\n","> __init__() (called the initializer) is one of special methods reserved by Python, and called automatically each time an instance is created. Special method names (begin and end with __ pronounced as \"dunder\") are ubiquitous in Python, and used for certain operations that are invoked by special syntax. \n","\n","\n","\n","\n","\n"," \n"]},{"cell_type":"markdown","metadata":{"id":"QGJpHz6zQFOt"},"source":["\n"," \n","- Each instance object created from a class gets its own namespace.\n","\n"," - Assignments to attributes of `self` create ***instance-level*** attributes (differ from instance to instance).\n","\n","\n","\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"TrTqqHSCAiTW","outputId":"91aed391-005d-4afc-af8d-61730fa7605d","executionInfo":{"status":"ok","timestamp":1710472312143,"user_tz":-480,"elapsed":300,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["('Amy', 27, 4.2, 'No')"]},"metadata":{},"execution_count":8}],"source":["# instance-level attributes\n","customer_1.name, customer_1.income, customer_1.years, customer_1.criminal"]},{"cell_type":"code","execution_count":null,"metadata":{"cell_style":"split","colab":{"base_uri":"https://localhost:8080/"},"id":"RFLsooll4v1l","outputId":"2da23f8a-d6bb-40ab-e036-7724acdf1b48","executionInfo":{"status":"ok","timestamp":1710472320066,"user_tz":-480,"elapsed":294,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["('Sam', 32, 1.5, 'Yes')"]},"metadata":{},"execution_count":9}],"source":["customer_2.name, customer_2.income, customer_2.years, customer_2.criminal"]},{"cell_type":"markdown","metadata":{"id":"RJY7RN484v1m"},"source":["\n","\n","- Instance objects also inherit attributes that live in the class objects from which they were generated:\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":35},"id":"PH6y-AJE4v1n","outputId":"c7de4fb8-3d9a-4fc7-e960-a11aae71a2e9","executionInfo":{"status":"ok","timestamp":1710472382204,"user_tz":-480,"elapsed":340,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'A class for bank customers.'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":10}],"source":["# class-level data attributes\n","customer_1.__doc__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":35},"id":"zgnmkJIIQFOv","outputId":"636bc6cd-450a-4254-832d-15c8ff2e52ea","executionInfo":{"status":"ok","timestamp":1710472383811,"user_tz":-480,"elapsed":3,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'A class for bank customers.'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":11}],"source":["customer_2.__doc__"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"uPkbR7nc80dd","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710472415516,"user_tz":-480,"elapsed":313,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"230bc7bc-492d-4490-86d6-dea7e774c353"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'Approve'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":12}],"source":["# class-level method attributes\n","# the instance is implicitly passed as the argument to self\n","customer_1.apply_loan()"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"D3F0iDaN8OAn","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710472433971,"user_tz":-480,"elapsed":291,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"426f226e-597a-4e36-b225-1ea44629c620"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'Reject'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":13}],"source":["customer_2.apply_loan()"]},{"cell_type":"markdown","source":["*Exercise*: What does the following code output?\n","\n","```Python\n","class People:\n","\n"," def __init__(self, name=\"Unknown\"):\n"," self.name = name\n","\n"," def namePrint(self):\n"," print(self.name)\n","\n","person1 = People(\"Sally\")\n","person2 = People()\n","person2.namePrint()\n","```"],"metadata":{"id":"mSk9sRlECJml"}},{"cell_type":"markdown","metadata":{"id":"Qja3RAKqwtyI"},"source":["## 2.3 Class Attributes vs. Instance Attributes\n","\n","Generally speaking, instance attributes are for data unique to each instance (defined inside the `__init__()` function) and class attributes are for things shared by all instances of the class.\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"MDDGxeA0xL_L","outputId":"2e2926e2-8f08-4f14-dd50-93a75956b702","executionInfo":{"status":"ok","timestamp":1710473150470,"user_tz":-480,"elapsed":319,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["mappingproxy({'__module__': '__main__',\n"," '__doc__': 'A class for bank customers.',\n"," '__init__': ,\n"," 'apply_loan': ,\n"," '__dict__': ,\n"," '__weakref__': })"]},"metadata":{},"execution_count":17}],"source":["Customer.__dict__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"hptIG3agxQAM","outputId":"410e624f-8c2c-41fe-da4c-3b450d6334bd","executionInfo":{"status":"ok","timestamp":1710473161095,"user_tz":-480,"elapsed":385,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}"]},"metadata":{},"execution_count":18}],"source":["customer_1.__dict__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"HBHiKf-Qxhzy","outputId":"38ee91dc-28d5-4142-8a8d-271343b4ede0","executionInfo":{"status":"ok","timestamp":1710473165247,"user_tz":-480,"elapsed":446,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Sam', 'income': 32, 'years': 1.5, 'criminal': 'Yes'}"]},"metadata":{},"execution_count":19}],"source":["customer_2.__dict__"]},{"cell_type":"markdown","metadata":{"id":"Bc3OiZob10JT"},"source":["*Exercise:* Write a Python class `Employee` with attributes like `emp_id`, `emp_name`, `emp_salary`, and `emp_department` and methods like `calculate_emp_salary`, and `assign_emp_department`.\n","\n","- Use 'assign_emp_department' method to change the department of an employee.\n","\n","- Use 'calculate_emp_salary' method to add overtime amount to salary. The method takes one argument: hours_worked, which is the number of hours worked by the employee. If the number of hours worked is more than 50, the method computes overtime and adds it to the salary. Overtime is calculated as following formula:\n","\n"," - overtime = hours_worked - 50\n"," - overtime amount = (overtime * (salary / 50))"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"-sSZZj4o10JT"},"outputs":[],"source":["# define your class here\n","class Employee:\n"," '''A class for company employees'''\n"," def __init__(self, emp_id, emp_name, emp_salary, emp_department):\n"," self.emp_id = emp_id\n"," self.emp_name = emp_name\n"," self.emp_salary = emp_salary\n"," self.emp_department = emp_department\n","\n"," def assign_emp_department(self, new_department):\n"," self.emp_department = new_department\n","\n"," def calculate_emp_salary(self, hours_worked):\n"," overtime = 0\n"," if hours_worked > 50:\n"," overtime = hours_worked - 50\n"," overtime_amount = (overtime * (self.emp_salary / 50))\n"," self.emp_salary += overtime_amount"]},{"cell_type":"markdown","metadata":{"id":"gsk09WhR10JT"},"source":["Instantiate Employee using `\"E7876\", \"ADAMS\", 50000, \"ACCOUNTING\"` and name it as `employee1`. Use `employee1.__dict__` to check attribute values."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"s0fY6TPo10JT","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710473954934,"user_tz":-480,"elapsed":311,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"5f6e0291-b070-4180-921c-c7478d0717cf"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'emp_id': 'E7876',\n"," 'emp_name': 'ADAMS',\n"," 'emp_salary': 50000,\n"," 'emp_department': 'ACCOUNTING'}"]},"metadata":{},"execution_count":30}],"source":["# write your code here\n","employee1 = Employee(\"E7876\", \"ADAMS\", 50000, \"ACCOUNTING\")\n","employee1.__dict__"]},{"cell_type":"markdown","metadata":{"id":"YSxOKbf510JT"},"source":["Use `assign_emp_department` method to change the department of employee1 to `OPERATIONS`"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"sZ5yDOvt10JU"},"outputs":[],"source":["# write your code here\n","employee1.assign_emp_department(\"OPERATIONS\")"]},{"cell_type":"markdown","metadata":{"id":"t1VSUEc010JU"},"source":["Use `calculate_emp_salary` method to add the overtime amount to salary of employee1 if he works for 60 hours"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"GdC2_M3X10JU"},"outputs":[],"source":["# write your code here\n","employee1.calculate_emp_salary(60)"]},{"cell_type":"markdown","metadata":{"id":"lvU_w3Qr10JU"},"source":["Use `employee1.__dict__` to check updated attribute values."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"7C8ZbcOY10JU","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710473967481,"user_tz":-480,"elapsed":306,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"724aab8f-9f42-463b-886d-58c60fc14a35"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'emp_id': 'E7876',\n"," 'emp_name': 'ADAMS',\n"," 'emp_salary': 60000.0,\n"," 'emp_department': 'OPERATIONS'}"]},"metadata":{},"execution_count":33}],"source":["# write your code here\n","employee1.__dict__"]},{"cell_type":"markdown","metadata":{"id":"YDLd63Dp4v1z"},"source":["\n","
\n","\n","\n","## 2.4 `__X__()` Methods\n","\n","\n","Running `dir(customer_1)` shows that some `__X__()` (pronouced as \"dunder X\") methods are available to `customer_1` (inherited from somewhere)."]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"9M-RS1XE4v10","outputId":"9f205107-23e0-4e59-ccc2-0d340174d6ee","executionInfo":{"status":"ok","timestamp":1710474017448,"user_tz":-480,"elapsed":851,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['__class__',\n"," '__delattr__',\n"," '__dict__',\n"," '__dir__',\n"," '__doc__',\n"," '__eq__',\n"," '__format__',\n"," '__ge__',\n"," '__getattribute__',\n"," '__gt__',\n"," '__hash__',\n"," '__init__',\n"," '__init_subclass__',\n"," '__le__',\n"," '__lt__',\n"," '__module__',\n"," '__ne__',\n"," '__new__',\n"," '__reduce__',\n"," '__reduce_ex__',\n"," '__repr__',\n"," '__setattr__',\n"," '__sizeof__',\n"," '__str__',\n"," '__subclasshook__',\n"," '__weakref__',\n"," 'apply_loan',\n"," 'criminal',\n"," 'income',\n"," 'name',\n"," 'years']"]},"metadata":{},"execution_count":34}],"source":["dir(customer_1)"]},{"cell_type":"markdown","metadata":{"id":"VvCiZBrl4v11"},"source":["\n","In Python, [dunder methods](https://docs.python.org/3/reference/datamodel.html#special-method-names) are methods that allow instances of a class to interact with the built-in functions and operators of the language. The word “dunder” comes from “double underscore”, because the names of dunder methods start and end with two underscores.\n","\n","Dunder methods exist for nearly every operation available to built-in types. The mapping from each of these operations to a dunder method is ***fixed*** and ***unchangeable***. The table below lists a few of the most straightforward ones:\n","\n","\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"2yYKbkOPMtSI"},"source":["|Operation | Expression (or Statement) | And Python Calls\n","|:-- |:-- |:-- |\n","|Addition |`a + b`| `a.__add__(b)` |\n","|Subtraction| `a - b`|`a.__sub__(b)`|\n","|Multiplication |`a * b`|`a.__mul__(b)`|\n","| Division |`a / b`|`a.__truediv__(b)`|\n","| Equality |`a == b`|`a.__eq__(b)`|\n","| Inequality |`a != b`|`a.__ne__(b)`|\n","| Less than |`a < b`|`a.__lt__(b)`|\n","| Greater than |`a > b`|`a.__gt__(b)`|\n","| Less than or equal to|\t`a <= b`|`a.__le__(b)`|\n","| Greater than or equal to|\t`a <= b`|`a.__ge__(b)`|\n","| Length |\t`len(s)`|`s.__len__()`|\n","| Membership tests |\t`x in s` | `s.__contains__(x)`|\n","| Attribute listing |\t`dir(x)` | `x.__dir__()`|\n","\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"Z7eeYgH0nHwV"},"source":["The `hasattr()` method returns true if an object has the given named attribute and false if it does not."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"0HkkFXgMMFq8","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474181559,"user_tz":-480,"elapsed":281,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"a41a255f-b86a-4ffe-929a-63227f62fd1a"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":35}],"source":["hasattr(\"string\", \"__len__\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"Fg1Wx-XvPu_u","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474204166,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"3f6b004b-9dd3-4717-db1e-9abb3db448fa"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["False"]},"metadata":{},"execution_count":36}],"source":["hasattr(1, \"__len__\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"MyHf0hqJPhfv","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474209755,"user_tz":-480,"elapsed":285,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"bdb1a324-aa6d-42e3-87cd-8c31aeb934db"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":37}],"source":["hasattr(1, \"__add__\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"cGBXiobXPprA","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474213415,"user_tz":-480,"elapsed":354,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"6f7b7bbe-b2d1-4902-d773-8e8648a645b8"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":38}],"source":["hasattr(\"string\", \"__add__\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"13RwPs-bVKFB","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474215568,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"4e8b7ee8-da62-473e-ba21-701ff9dac3f6"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":39}],"source":["hasattr(\"string\", \"__contains__\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"K8pca4B9VMmY","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474218935,"user_tz":-480,"elapsed":302,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"b97e8715-2d73-4a5a-e057-2cea93546f63"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["False"]},"metadata":{},"execution_count":40}],"source":["hasattr(1, \"__contains__\")"]},{"cell_type":"markdown","metadata":{"id":"KoyFG_KIUvSF"},"source":["By defining dunder methods, we can retrofit operations invoked by Python's built-in syntax (such as arithmetic operations, comparisons, indexing, and slicing) to a user-defined class."]},{"cell_type":"markdown","metadata":{"id":"jshrquEtMEnB"},"source":["---\n","\n","
\n","\n","### `__repr__()`\n","\n","\n","Typing the name directly into the interpreter prints out its string representation:"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"x8acvDcB4v12","outputId":"9b7d7484-20f2-4373-d012-99def5d527c7","executionInfo":{"status":"ok","timestamp":1710474292118,"user_tz":-480,"elapsed":313,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["<__main__.Customer at 0x7ffa94a7f460>"]},"metadata":{},"execution_count":41}],"source":["customer_1"]},{"cell_type":"markdown","metadata":{"id":"JEYpFUlg4v13"},"source":["Behind the scene, [`__repr__()`](https://docs.python.org/3/reference/datamodel.html#object.__repr__) is invoked to return a string representing the object.\n","It's what we get when the Python intepreter shows an object:\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":35},"id":"y_wLIowQ4v13","outputId":"d141a1b2-cc0f-463d-c421-32304be90401","executionInfo":{"status":"ok","timestamp":1710474323839,"user_tz":-480,"elapsed":292,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'<__main__.Customer object at 0x7ffa94a7f460>'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":42}],"source":["customer_1.__repr__()"]},{"cell_type":"markdown","metadata":{"id":"xUiRkf9C4v14"},"source":["We can override the default `__repr__()` to produce a more readable string representation:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"L-lXi12q4v15"},"outputs":[],"source":["class Customer:\n"," '''A class for bank customers.'''\n","\n"," def __init__(self, name, income, years, criminal='No'):\n"," '''populate the attributes of a particular customer'''\n"," self.name = name\n"," self.income = income\n"," self.years = years\n"," self.criminal = criminal\n","\n"," def __repr__(self):\n"," '''define a string representation of a given instance'''\n"," return f\"Customer: {self.__dict__}\"\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"bUPjfenhRr1d","outputId":"9a6b405f-5e46-47aa-efd2-3139393e1c6e","executionInfo":{"status":"ok","timestamp":1710745578696,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["Customer: {'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}"]},"metadata":{},"execution_count":4}],"source":["customer_1 = Customer(\"Amy\", 27, 4.2)\n","customer_1"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"yo131WWhBfW1","outputId":"d1bd16eb-1196-4737-885b-3502309fb4cf","executionInfo":{"status":"ok","timestamp":1710745580500,"user_tz":-480,"elapsed":285,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["Customer: {'name': 'Sam', 'income': 32, 'years': 1.5, 'criminal': 'Yes'}"]},"metadata":{},"execution_count":5}],"source":["customer_2 = Customer(\"Sam\", 32, 1.5, \"Yes\")\n","customer_2"]},{"cell_type":"markdown","metadata":{"id":"ZoyRMf7SAaVc"},"source":["\n","---\n","\n","
\n","\n","### `__str__()`\n","\n","The `__str__` method is called when you use the str() function on an object or when you use the print() function to print an object."]},{"cell_type":"code","source":["\"multi-line\\nstring\""],"metadata":{"id":"7rJRsH4-VkZz","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710474484236,"user_tz":-480,"elapsed":306,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"766b7d2f-fd32-4579-d2d0-5509bc2e0d9b"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["'multi-line\\nstring'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":46}]},{"cell_type":"code","source":["print(\"multi-line\\nstring\")"],"metadata":{"id":"Zrbt4PTEVlsD","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710474495400,"user_tz":-480,"elapsed":300,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"765f4ed6-2a67-4e07-a197-0b37a5b75673"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["multi-line\n","string\n"]}]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"X3kIZZICAjx0","outputId":"25b063a9-8d00-4fea-90d6-d4a93c2db34c","executionInfo":{"status":"ok","timestamp":1710474501071,"user_tz":-480,"elapsed":272,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["Customer: {'name': 'Amy', 'income': 27, 'years': 4.2, 'criminal': 'No'}\n"]}],"source":["print(customer_1)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ma3oIUDcA36F"},"outputs":[],"source":["class Customer:\n"," '''A class for bank customers.'''\n","\n"," def __init__(self, name, income, years, criminal='No'):\n"," '''populate the attributes of a particular instance'''\n"," self.name = name\n"," self.income = income\n"," self.years = years\n"," self.criminal = criminal\n","\n"," def __repr__(self):\n"," '''defines a string representation of a given instance'''\n"," return f\"Customer: {self.__dict__}\"\n","\n"," def __str__(self):\n"," '''defines a printable representation of a given instance'''\n"," prefix = \"Customer:\\n\"\n"," return prefix + '\\n'.join([f'{k.title()} -> {v}' for k, v in self.__dict__.items()]) # The title() method returns a string where the first character in every word is upper case.\n"," # The return value must be a string object\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"2p4ZBR--BYyo","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710745622004,"user_tz":-480,"elapsed":272,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"fbaf3aaf-e280-4a40-a3a6-1740778a2e0b"},"outputs":[{"output_type":"stream","name":"stdout","text":["Customer:\n","Name -> Amy\n","Income -> 27\n","Years -> 4.2\n","Criminal -> No\n"]}],"source":["customer_1 = Customer(\"Amy\", 27, 4.2)\n","print(customer_1)"]},{"cell_type":"markdown","metadata":{"id":"RoOgED6QKik-"},"source":["\n","---\n","\n","
\n","\n","### `__iter__()`\n","\n","\n","`__iter__()` methods for most commonly used operations are not provided by default. The corresponding operations are then not supported for the class's instances.\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":159},"id":"siOeXdyfKluc","outputId":"fbf46559-0db4-4fe4-8520-061d86b3fe11","executionInfo":{"status":"error","timestamp":1710745682482,"user_tz":-480,"elapsed":370,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"error","ename":"TypeError","evalue":"'Customer' object is not iterable","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mcustomer_1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"{k} -> {v}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mTypeError\u001b[0m: 'Customer' object is not iterable"]}],"source":["for k, v in customer_1:\n"," print(f\"{k} -> {v}\")"]},{"cell_type":"markdown","metadata":{"id":"S3QqF8haLfza"},"source":["`__iter__()` makes a class's instances iterable. We implement it by using a generator expression to yield the components one after the other:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"HmZSFlGOKw2d"},"outputs":[],"source":["class Customer:\n"," '''A class for bank customers.'''\n","\n"," def __init__(self, name, income, years, criminal='No'):\n"," '''populate the attributes of a particular instance'''\n"," self.name = name\n"," self.income = income\n"," self.years = years\n"," self.criminal = criminal\n","\n"," def __repr__(self):\n"," '''define a string representation of a given instance'''\n"," return f\"Customer: {self.__dict__}\"\n","\n"," def __str__(self):\n"," '''define a printable string representation of a given instance'''\n"," prefix = \"Customer:\\n\"\n"," return prefix + '\\n'.join([f'{k.title()} -> {v}' for k, v in self.__dict__.items()]) # The return value must be a string object\n","\n"," def __iter__(self):\n"," '''make an instance iterable'''\n"," return ((k, v) for k, v in self.__dict__.items())\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"tHJqRc8-LFo6","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710745780651,"user_tz":-480,"elapsed":286,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"ca533ddd-0a75-4998-b7ca-d15a6dd0741d"},"outputs":[{"output_type":"stream","name":"stdout","text":["name -> Amy\n","income -> 27\n","years -> 4.2\n","criminal -> No\n"]}],"source":["customer_1 = Customer(\"Amy\", 27, 4.2)\n","for k, v in customer_1:\n"," print(f\"{k} -> {v}\")"]},{"cell_type":"markdown","metadata":{"id":"tA67DyPk4v2A"},"source":["\n","
\n","\n","\n","## 2.5 Defining a Derived Class \n","\n","\n","\n","Python allows us to form a **derived class** (**subclass**) from one or more than one **base class** (**superclass**) to specialize behaviors while reusing existing code.\n","\n","To create a subclass, we just list the base class in parentheses in the `class` statement's header (seperated by `,` if there is more than one base class) :"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"rsNNNIPz4v2B"},"outputs":[],"source":["class Person:\n","\n"," def __init__(self, name, date_of_birth, gender):\n"," self.name = name\n"," self.date_of_birth = date_of_birth\n"," self.gender = gender\n","\n"," def __repr__(self):\n"," '''define a string representation of a given instance'''\n"," return f\"{self.__dict__}\"\n","\n","\n","class Customer(Person):\n","\n"," def __init__(self, name, date_of_birth, gender, income, years, criminal=\"No\"):\n"," # a method call notation; self should not be present\n"," super().__init__(name, date_of_birth, gender)\n"," self.income = income\n"," self.years = years\n"," self.criminal = criminal\n","\n"," def apply_loan(self):\n"," if self.income >= 70:\n"," result = 'Approve'\n"," elif self.income >= 30:\n"," if self.years >= 2:\n"," result = 'Approve'\n"," else:result = 'Reject'\n"," else:\n"," if self.criminal == \"No\":\n"," result = 'Approve'\n"," else: result = 'Reject'\n"," return result"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"Sn6iEqV5wKLC","outputId":"33832aea-6099-49bc-8a52-f9a5fac4333f","executionInfo":{"status":"ok","timestamp":1710746059664,"user_tz":-480,"elapsed":389,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["mappingproxy({'__module__': '__main__',\n"," '__init__': ,\n"," '__repr__': ,\n"," '__dict__': ,\n"," '__weakref__': ,\n"," '__doc__': None})"]},"metadata":{},"execution_count":13}],"source":["Person.__dict__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"jH3gWdT2wXhc","outputId":"452e77e2-63bd-4fab-f8c4-b6582eda70db","executionInfo":{"status":"ok","timestamp":1710746061909,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["mappingproxy({'__module__': '__main__',\n"," '__init__': ,\n"," 'apply_loan': ,\n"," '__doc__': None})"]},"metadata":{},"execution_count":14}],"source":["Customer.__dict__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"DvrwZnAfpwwQ","outputId":"6c97a766-d866-4297-8094-f379fe527311","executionInfo":{"status":"ok","timestamp":1710746080040,"user_tz":-480,"elapsed":303,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Amy', 'date_of_birth': 'Oct. 10, 1999', 'gender': 'F'}"]},"metadata":{},"execution_count":15}],"source":["a_person = Person(\"Amy\", \"Oct. 10, 1999\", \"F\")\n","a_person"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"pl3DS11TTh_0","outputId":"1cd710c5-6125-4bde-a6cc-c7b397a40f3d","executionInfo":{"status":"ok","timestamp":1710746081745,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Amy', 'date_of_birth': 'Oct. 10, 1999', 'gender': 'F'}"]},"metadata":{},"execution_count":16}],"source":["a_person.__dict__"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"jZUiY6t1m2ct","outputId":"5ec44d59-d192-4b18-fc2a-5b359d99091d","executionInfo":{"status":"ok","timestamp":1710746093023,"user_tz":-480,"elapsed":288,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Amy', 'date_of_birth': 'Oct. 10, 1999', 'gender': 'F', 'income': 27, 'years': 4.2, 'criminal': 'No'}"]},"metadata":{},"execution_count":17}],"source":["customer_3 = Customer(\"Amy\", \"Oct. 10, 1999\", \"F\", 27, 4.2)\n","customer_3"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"tYctLU5YnPtw","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746094810,"user_tz":-480,"elapsed":413,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"03f0c34c-526d-4b1a-987c-d314e0eaf046"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'name': 'Amy',\n"," 'date_of_birth': 'Oct. 10, 1999',\n"," 'gender': 'F',\n"," 'income': 27,\n"," 'years': 4.2,\n"," 'criminal': 'No'}"]},"metadata":{},"execution_count":18}],"source":["customer_3.__dict__"]},{"cell_type":"markdown","metadata":{"id":"TM-P1e104v2F"},"source":["Each instance inherits names from the class it's generated from, as well as all of that class's superclasses:"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"kLdKCIxp4v2F","outputId":"20d5f1be-2f6e-4509-9d78-9fa8643a67c6","executionInfo":{"status":"ok","timestamp":1710746130565,"user_tz":-480,"elapsed":305,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'apply_loan']\n"]}],"source":["print(dir(Customer))"]},{"cell_type":"markdown","metadata":{"id":"xqfqpGy24v2H"},"source":["To resolve attribute references, Python goes through the following steps:\n","\n","1. The search first checks the instance's namespace and then its class's namespace.\n","2. If a requested attribute is not found in the class's namespace, the search proceeds to look in the most recent superclass.\n","3. This rule is applied ***recursively*** upward through a **hirerarchy of classes** until all superclasses are searched.\n","\n","Searches stop at the first appearance of the attribute name that it finds."]},{"cell_type":"markdown","metadata":{"id":"7mrijKs8Z4sw"},"source":["\n","
\n","\n","# 3 Modules\n","\n","Most of the functionality in Python is provided by **modules**, which are typically Python program files that contain definitions and statements we want to import to use.\n","\n","\n","Let's look at a .py file that contains the following code:\n","\n","```python\n","name = \"Business Analytics\"\n","\n","array = [1, 2, 3]\n","\n","def foo(arg):\n"," print('arg = {}'.format(arg) )\n","``` \n","\n","It can be read in as a module using [the `import` statement](https://docs.python.org/3/reference/simple_stmts.html#import):\n"]},{"cell_type":"code","execution_count":20,"metadata":{"id":"9uYDLlgqkgRG","executionInfo":{"status":"ok","timestamp":1710746599484,"user_tz":-480,"elapsed":331,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[],"source":["import mod"]},{"cell_type":"code","execution_count":21,"metadata":{"id":"10uylO6gjIKT","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746604339,"user_tz":-480,"elapsed":368,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"1655a297-950d-4b44-e926-92642fe50085"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Customer',\n"," 'In',\n"," 'Out',\n"," 'Person',\n"," '_',\n"," '_13',\n"," '_14',\n"," '_15',\n"," '_16',\n"," '_17',\n"," '_18',\n"," '_2',\n"," '_4',\n"," '_5',\n"," '__',\n"," '___',\n"," '__builtin__',\n"," '__builtins__',\n"," '__doc__',\n"," '__loader__',\n"," '__name__',\n"," '__package__',\n"," '__spec__',\n"," '_dh',\n"," '_i',\n"," '_i1',\n"," '_i10',\n"," '_i11',\n"," '_i12',\n"," '_i13',\n"," '_i14',\n"," '_i15',\n"," '_i16',\n"," '_i17',\n"," '_i18',\n"," '_i19',\n"," '_i2',\n"," '_i20',\n"," '_i21',\n"," '_i3',\n"," '_i4',\n"," '_i5',\n"," '_i6',\n"," '_i7',\n"," '_i8',\n"," '_i9',\n"," '_ih',\n"," '_ii',\n"," '_iii',\n"," '_oh',\n"," 'a_person',\n"," 'customer_1',\n"," 'customer_2',\n"," 'customer_3',\n"," 'exit',\n"," 'get_ipython',\n"," 'k',\n"," 'mod',\n"," 'quit',\n"," 'v']"]},"metadata":{},"execution_count":21}],"source":["dir()"]},{"cell_type":"code","execution_count":22,"metadata":{"id":"71iQwgnNjIKT","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746632211,"user_tz":-480,"elapsed":301,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"6c73d77d-59b2-4385-aaac-414683037a4a"},"outputs":[{"output_type":"execute_result","data":{"text/plain":[""]},"metadata":{},"execution_count":22}],"source":["mod"]},{"cell_type":"code","execution_count":23,"metadata":{"id":"ZDtthmdj0krP","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746635345,"user_tz":-480,"elapsed":301,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d38772a2-f853-47c7-915e-6cc20f9e3419"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["module"]},"metadata":{},"execution_count":23}],"source":["type(mod)"]},{"cell_type":"markdown","metadata":{"id":"4z5sXyVgMSSH"},"source":["\n","The first time a module is imported, Python creates a module object, which is a wrapper of a namespace, and executes all ***top-level*** assignments (including function and class definitions) to create module attributes that populate the new namespace:\n","\n","
\n","\n",""]},{"cell_type":"code","execution_count":24,"metadata":{"id":"-RqJmwcJMSSH","scrolled":true,"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746690108,"user_tz":-480,"elapsed":293,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"e793bef5-b245-412f-e2f1-5b2ad7c96936"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['__builtins__',\n"," '__cached__',\n"," '__doc__',\n"," '__file__',\n"," '__loader__',\n"," '__name__',\n"," '__package__',\n"," '__spec__',\n"," 'array',\n"," 'foo',\n"," 'name']"]},"metadata":{},"execution_count":24}],"source":["dir(mod)"]},{"cell_type":"markdown","metadata":{"id":"HohMk_GT7IQ0"},"source":["These names are now available for use, and the dot notation is used to refer to them:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"3ydFDxA6MSSJ"},"outputs":[],"source":["mod.array"]},{"cell_type":"code","execution_count":25,"metadata":{"id":"I2G8fCyrz3ap","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710746732516,"user_tz":-480,"elapsed":285,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"660fb512-5c2c-4410-fb19-89786306477c"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'mod'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":25}],"source":["mod.__name__"]},{"cell_type":"code","execution_count":26,"metadata":{"id":"tWmm3TA_jIKV","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710746735664,"user_tz":-480,"elapsed":295,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"0021329f-e9fc-4952-ebb8-b868d1a79501"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'/content/mod.py'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":26}],"source":["mod.__file__"]},{"cell_type":"markdown","metadata":{"id":"vwvr50KNMSSK"},"source":["\n","\n","> Normally, module namespaces last until the session terminates."]},{"cell_type":"markdown","metadata":{"id":"IYNU-r1sMSSK"},"source":["\n","\n","
\n","\n","\n","### The `import` Statement\n","\n","Useful modules that form the [standard library](https://docs.python.org/3/library/) include `os`, `sys`, `math`, `random`, `shutil`, and so on."]},{"cell_type":"code","execution_count":27,"metadata":{"id":"Cqc561sLxEPz","executionInfo":{"status":"ok","timestamp":1710746796763,"user_tz":-480,"elapsed":274,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[],"source":["import random"]},{"cell_type":"code","execution_count":28,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"gLR427M20wL5","outputId":"756dbcaa-9375-488a-fe40-8d93e25de1e9","executionInfo":{"status":"ok","timestamp":1710746798714,"user_tz":-480,"elapsed":352,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[{"output_type":"execute_result","data":{"text/plain":[""]},"metadata":{},"execution_count":28}],"source":["random"]},{"cell_type":"code","execution_count":29,"metadata":{"id":"QzMtHOldMSSL","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746801017,"user_tz":-480,"elapsed":277,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"04839a01-e69c-4020-f4fc-16b3a3ca202b"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["['BPF',\n"," 'LOG4',\n"," 'NV_MAGICCONST',\n"," 'RECIP_BPF',\n"," 'Random',\n"," 'SG_MAGICCONST',\n"," 'SystemRandom',\n"," 'TWOPI',\n"," '_ONE',\n"," '_Sequence',\n"," '_Set',\n"," '__all__',\n"," '__builtins__',\n"," '__cached__',\n"," '__doc__',\n"," '__file__',\n"," '__loader__',\n"," '__name__',\n"," '__package__',\n"," '__spec__',\n"," '_accumulate',\n"," '_acos',\n"," '_bisect',\n"," '_ceil',\n"," '_cos',\n"," '_e',\n"," '_exp',\n"," '_floor',\n"," '_index',\n"," '_inst',\n"," '_isfinite',\n"," '_log',\n"," '_os',\n"," '_pi',\n"," '_random',\n"," '_repeat',\n"," '_sha512',\n"," '_sin',\n"," '_sqrt',\n"," '_test',\n"," '_test_generator',\n"," '_urandom',\n"," '_warn',\n"," 'betavariate',\n"," 'choice',\n"," 'choices',\n"," 'expovariate',\n"," 'gammavariate',\n"," 'gauss',\n"," 'getrandbits',\n"," 'getstate',\n"," 'lognormvariate',\n"," 'normalvariate',\n"," 'paretovariate',\n"," 'randbytes',\n"," 'randint',\n"," 'random',\n"," 'randrange',\n"," 'sample',\n"," 'seed',\n"," 'setstate',\n"," 'shuffle',\n"," 'triangular',\n"," 'uniform',\n"," 'vonmisesvariate',\n"," 'weibullvariate']"]},"metadata":{},"execution_count":29}],"source":["dir(random) # random.py"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ZXUsJ1dE7HWQ"},"outputs":[],"source":["random.randint(0, 10) # Return a random number between 0 and 10 (both included)"]},{"cell_type":"markdown","metadata":{"id":"-TjIpMyO7QTV"},"source":["Using `help()` gets the documentation for this function:"]},{"cell_type":"code","execution_count":30,"metadata":{"id":"gnnxEoo37Wsw","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746837313,"user_tz":-480,"elapsed":361,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"9c940695-0aa6-42fa-f68c-a0dc50ffca7e"},"outputs":[{"output_type":"stream","name":"stdout","text":["Help on module random:\n","\n","NAME\n"," random - Random variable generators.\n","\n","MODULE REFERENCE\n"," https://docs.python.org/3.10/library/random.html\n"," \n"," The following documentation is automatically generated from the Python\n"," source files. It may be incomplete, incorrect or include features that\n"," are considered implementation detail and may vary between Python\n"," implementations. When in doubt, consult the module reference at the\n"," location listed above.\n","\n","DESCRIPTION\n"," bytes\n"," -----\n"," uniform bytes (values between 0 and 255)\n"," \n"," integers\n"," --------\n"," uniform within range\n"," \n"," sequences\n"," ---------\n"," pick random element\n"," pick random sample\n"," pick weighted random sample\n"," generate random permutation\n"," \n"," distributions on the real line:\n"," ------------------------------\n"," uniform\n"," triangular\n"," normal (Gaussian)\n"," lognormal\n"," negative exponential\n"," gamma\n"," beta\n"," pareto\n"," Weibull\n"," \n"," distributions on the circle (angles 0 to 2pi)\n"," ---------------------------------------------\n"," circular uniform\n"," von Mises\n"," \n"," General notes on the underlying Mersenne Twister core generator:\n"," \n"," * The period is 2**19937-1.\n"," * It is one of the most extensively tested generators in existence.\n"," * The random() method is implemented in C, executes in a single Python step,\n"," and is, therefore, threadsafe.\n","\n","CLASSES\n"," _random.Random(builtins.object)\n"," Random\n"," SystemRandom\n"," \n"," class Random(_random.Random)\n"," | Random(x=None)\n"," | \n"," | Random number generator base class used by bound module functions.\n"," | \n"," | Used to instantiate instances of Random to get generators that don't\n"," | share state.\n"," | \n"," | Class Random can also be subclassed if you want to use a different basic\n"," | generator of your own devising: in that case, override the following\n"," | methods: random(), seed(), getstate(), and setstate().\n"," | Optionally, implement a getrandbits() method so that randrange()\n"," | can cover arbitrarily large ranges.\n"," | \n"," | Method resolution order:\n"," | Random\n"," | _random.Random\n"," | builtins.object\n"," | \n"," | Methods defined here:\n"," | \n"," | __getstate__(self)\n"," | # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n"," | # longer called; we leave it here because it has been here since random was\n"," | # rewritten back in 2001 and why risk breaking something.\n"," | \n"," | __init__(self, x=None)\n"," | Initialize an instance.\n"," | \n"," | Optional argument x controls seeding, as for Random.seed().\n"," | \n"," | __reduce__(self)\n"," | Helper for pickle.\n"," | \n"," | __setstate__(self, state)\n"," | \n"," | betavariate(self, alpha, beta)\n"," | Beta distribution.\n"," | \n"," | Conditions on the parameters are alpha > 0 and beta > 0.\n"," | Returned values range between 0 and 1.\n"," | \n"," | choice(self, seq)\n"," | Choose a random element from a non-empty sequence.\n"," | \n"," | choices(self, population, weights=None, *, cum_weights=None, k=1)\n"," | Return a k sized list of population elements chosen with replacement.\n"," | \n"," | If the relative weights or cumulative weights are not specified,\n"," | the selections are made with equal probability.\n"," | \n"," | expovariate(self, lambd)\n"," | Exponential distribution.\n"," | \n"," | lambd is 1.0 divided by the desired mean. It should be\n"," | nonzero. (The parameter would be called \"lambda\", but that is\n"," | a reserved word in Python.) Returned values range from 0 to\n"," | positive infinity if lambd is positive, and from negative\n"," | infinity to 0 if lambd is negative.\n"," | \n"," | gammavariate(self, alpha, beta)\n"," | Gamma distribution. Not the gamma function!\n"," | \n"," | Conditions on the parameters are alpha > 0 and beta > 0.\n"," | \n"," | The probability distribution function is:\n"," | \n"," | x ** (alpha - 1) * math.exp(-x / beta)\n"," | pdf(x) = --------------------------------------\n"," | math.gamma(alpha) * beta ** alpha\n"," | \n"," | gauss(self, mu, sigma)\n"," | Gaussian distribution.\n"," | \n"," | mu is the mean, and sigma is the standard deviation. This is\n"," | slightly faster than the normalvariate() function.\n"," | \n"," | Not thread-safe without a lock around calls.\n"," | \n"," | getstate(self)\n"," | Return internal state; can be passed to setstate() later.\n"," | \n"," | lognormvariate(self, mu, sigma)\n"," | Log normal distribution.\n"," | \n"," | If you take the natural logarithm of this distribution, you'll get a\n"," | normal distribution with mean mu and standard deviation sigma.\n"," | mu can have any value, and sigma must be greater than zero.\n"," | \n"," | normalvariate(self, mu, sigma)\n"," | Normal distribution.\n"," | \n"," | mu is the mean, and sigma is the standard deviation.\n"," | \n"," | paretovariate(self, alpha)\n"," | Pareto distribution. alpha is the shape parameter.\n"," | \n"," | randbytes(self, n)\n"," | Generate n random bytes.\n"," | \n"," | randint(self, a, b)\n"," | Return random integer in range [a, b], including both end points.\n"," | \n"," | randrange(self, start, stop=None, step=1)\n"," | Choose a random item from range(start, stop[, step]).\n"," | \n"," | This fixes the problem with randint() which includes the\n"," | endpoint; in Python this is usually not what you want.\n"," | \n"," | sample(self, population, k, *, counts=None)\n"," | Chooses k unique random elements from a population sequence or set.\n"," | \n"," | Returns a new list containing elements from the population while\n"," | leaving the original population unchanged. The resulting list is\n"," | in selection order so that all sub-slices will also be valid random\n"," | samples. This allows raffle winners (the sample) to be partitioned\n"," | into grand prize and second place winners (the subslices).\n"," | \n"," | Members of the population need not be hashable or unique. If the\n"," | population contains repeats, then each occurrence is a possible\n"," | selection in the sample.\n"," | \n"," | Repeated elements can be specified one at a time or with the optional\n"," | counts parameter. For example:\n"," | \n"," | sample(['red', 'blue'], counts=[4, 2], k=5)\n"," | \n"," | is equivalent to:\n"," | \n"," | sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n"," | \n"," | To choose a sample from a range of integers, use range() for the\n"," | population argument. This is especially fast and space efficient\n"," | for sampling from a large population:\n"," | \n"," | sample(range(10000000), 60)\n"," | \n"," | seed(self, a=None, version=2)\n"," | Initialize internal state from a seed.\n"," | \n"," | The only supported seed types are None, int, float,\n"," | str, bytes, and bytearray.\n"," | \n"," | None or no argument seeds from current time or from an operating\n"," | system specific randomness source if available.\n"," | \n"," | If *a* is an int, all bits are used.\n"," | \n"," | For version 2 (the default), all of the bits are used if *a* is a str,\n"," | bytes, or bytearray. For version 1 (provided for reproducing random\n"," | sequences from older versions of Python), the algorithm for str and\n"," | bytes generates a narrower range of seeds.\n"," | \n"," | setstate(self, state)\n"," | Restore internal state from object returned by getstate().\n"," | \n"," | shuffle(self, x, random=None)\n"," | Shuffle list x in place, and return None.\n"," | \n"," | Optional argument random is a 0-argument function returning a\n"," | random float in [0.0, 1.0); if it is the default None, the\n"," | standard random.random will be used.\n"," | \n"," | triangular(self, low=0.0, high=1.0, mode=None)\n"," | Triangular distribution.\n"," | \n"," | Continuous distribution bounded by given lower and upper limits,\n"," | and having a given mode value in-between.\n"," | \n"," | http://en.wikipedia.org/wiki/Triangular_distribution\n"," | \n"," | uniform(self, a, b)\n"," | Get a random number in the range [a, b) or [a, b] depending on rounding.\n"," | \n"," | vonmisesvariate(self, mu, kappa)\n"," | Circular data distribution.\n"," | \n"," | mu is the mean angle, expressed in radians between 0 and 2*pi, and\n"," | kappa is the concentration parameter, which must be greater than or\n"," | equal to zero. If kappa is equal to zero, this distribution reduces\n"," | to a uniform random angle over the range 0 to 2*pi.\n"," | \n"," | weibullvariate(self, alpha, beta)\n"," | Weibull distribution.\n"," | \n"," | alpha is the scale parameter and beta is the shape parameter.\n"," | \n"," | ----------------------------------------------------------------------\n"," | Class methods defined here:\n"," | \n"," | __init_subclass__(**kwargs) from builtins.type\n"," | Control how subclasses generate random integers.\n"," | \n"," | The algorithm a subclass can use depends on the random() and/or\n"," | getrandbits() implementation available to it and determines\n"," | whether it can generate random integers from arbitrarily large\n"," | ranges.\n"," | \n"," | ----------------------------------------------------------------------\n"," | Data descriptors defined here:\n"," | \n"," | __dict__\n"," | dictionary for instance variables (if defined)\n"," | \n"," | __weakref__\n"," | list of weak references to the object (if defined)\n"," | \n"," | ----------------------------------------------------------------------\n"," | Data and other attributes defined here:\n"," | \n"," | VERSION = 3\n"," | \n"," | ----------------------------------------------------------------------\n"," | Methods inherited from _random.Random:\n"," | \n"," | getrandbits(self, k, /)\n"," | getrandbits(k) -> x. Generates an int with k random bits.\n"," | \n"," | random(self, /)\n"," | random() -> x in the interval [0, 1).\n"," | \n"," | ----------------------------------------------------------------------\n"," | Static methods inherited from _random.Random:\n"," | \n"," | __new__(*args, **kwargs) from builtins.type\n"," | Create and return a new object. See help(type) for accurate signature.\n"," \n"," class SystemRandom(Random)\n"," | SystemRandom(x=None)\n"," | \n"," | Alternate random number generator using sources provided\n"," | by the operating system (such as /dev/urandom on Unix or\n"," | CryptGenRandom on Windows).\n"," | \n"," | Not available on all systems (see os.urandom() for details).\n"," | \n"," | Method resolution order:\n"," | SystemRandom\n"," | Random\n"," | _random.Random\n"," | builtins.object\n"," | \n"," | Methods defined here:\n"," | \n"," | getrandbits(self, k)\n"," | getrandbits(k) -> x. Generates an int with k random bits.\n"," | \n"," | getstate = _notimplemented(self, *args, **kwds)\n"," | \n"," | randbytes(self, n)\n"," | Generate n random bytes.\n"," | \n"," | random(self)\n"," | Get the next random number in the range [0.0, 1.0).\n"," | \n"," | seed(self, *args, **kwds)\n"," | Stub method. Not used for a system random number generator.\n"," | \n"," | setstate = _notimplemented(self, *args, **kwds)\n"," | \n"," | ----------------------------------------------------------------------\n"," | Methods inherited from Random:\n"," | \n"," | __getstate__(self)\n"," | # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n"," | # longer called; we leave it here because it has been here since random was\n"," | # rewritten back in 2001 and why risk breaking something.\n"," | \n"," | __init__(self, x=None)\n"," | Initialize an instance.\n"," | \n"," | Optional argument x controls seeding, as for Random.seed().\n"," | \n"," | __reduce__(self)\n"," | Helper for pickle.\n"," | \n"," | __setstate__(self, state)\n"," | \n"," | betavariate(self, alpha, beta)\n"," | Beta distribution.\n"," | \n"," | Conditions on the parameters are alpha > 0 and beta > 0.\n"," | Returned values range between 0 and 1.\n"," | \n"," | choice(self, seq)\n"," | Choose a random element from a non-empty sequence.\n"," | \n"," | choices(self, population, weights=None, *, cum_weights=None, k=1)\n"," | Return a k sized list of population elements chosen with replacement.\n"," | \n"," | If the relative weights or cumulative weights are not specified,\n"," | the selections are made with equal probability.\n"," | \n"," | expovariate(self, lambd)\n"," | Exponential distribution.\n"," | \n"," | lambd is 1.0 divided by the desired mean. It should be\n"," | nonzero. (The parameter would be called \"lambda\", but that is\n"," | a reserved word in Python.) Returned values range from 0 to\n"," | positive infinity if lambd is positive, and from negative\n"," | infinity to 0 if lambd is negative.\n"," | \n"," | gammavariate(self, alpha, beta)\n"," | Gamma distribution. Not the gamma function!\n"," | \n"," | Conditions on the parameters are alpha > 0 and beta > 0.\n"," | \n"," | The probability distribution function is:\n"," | \n"," | x ** (alpha - 1) * math.exp(-x / beta)\n"," | pdf(x) = --------------------------------------\n"," | math.gamma(alpha) * beta ** alpha\n"," | \n"," | gauss(self, mu, sigma)\n"," | Gaussian distribution.\n"," | \n"," | mu is the mean, and sigma is the standard deviation. This is\n"," | slightly faster than the normalvariate() function.\n"," | \n"," | Not thread-safe without a lock around calls.\n"," | \n"," | lognormvariate(self, mu, sigma)\n"," | Log normal distribution.\n"," | \n"," | If you take the natural logarithm of this distribution, you'll get a\n"," | normal distribution with mean mu and standard deviation sigma.\n"," | mu can have any value, and sigma must be greater than zero.\n"," | \n"," | normalvariate(self, mu, sigma)\n"," | Normal distribution.\n"," | \n"," | mu is the mean, and sigma is the standard deviation.\n"," | \n"," | paretovariate(self, alpha)\n"," | Pareto distribution. alpha is the shape parameter.\n"," | \n"," | randint(self, a, b)\n"," | Return random integer in range [a, b], including both end points.\n"," | \n"," | randrange(self, start, stop=None, step=1)\n"," | Choose a random item from range(start, stop[, step]).\n"," | \n"," | This fixes the problem with randint() which includes the\n"," | endpoint; in Python this is usually not what you want.\n"," | \n"," | sample(self, population, k, *, counts=None)\n"," | Chooses k unique random elements from a population sequence or set.\n"," | \n"," | Returns a new list containing elements from the population while\n"," | leaving the original population unchanged. The resulting list is\n"," | in selection order so that all sub-slices will also be valid random\n"," | samples. This allows raffle winners (the sample) to be partitioned\n"," | into grand prize and second place winners (the subslices).\n"," | \n"," | Members of the population need not be hashable or unique. If the\n"," | population contains repeats, then each occurrence is a possible\n"," | selection in the sample.\n"," | \n"," | Repeated elements can be specified one at a time or with the optional\n"," | counts parameter. For example:\n"," | \n"," | sample(['red', 'blue'], counts=[4, 2], k=5)\n"," | \n"," | is equivalent to:\n"," | \n"," | sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n"," | \n"," | To choose a sample from a range of integers, use range() for the\n"," | population argument. This is especially fast and space efficient\n"," | for sampling from a large population:\n"," | \n"," | sample(range(10000000), 60)\n"," | \n"," | shuffle(self, x, random=None)\n"," | Shuffle list x in place, and return None.\n"," | \n"," | Optional argument random is a 0-argument function returning a\n"," | random float in [0.0, 1.0); if it is the default None, the\n"," | standard random.random will be used.\n"," | \n"," | triangular(self, low=0.0, high=1.0, mode=None)\n"," | Triangular distribution.\n"," | \n"," | Continuous distribution bounded by given lower and upper limits,\n"," | and having a given mode value in-between.\n"," | \n"," | http://en.wikipedia.org/wiki/Triangular_distribution\n"," | \n"," | uniform(self, a, b)\n"," | Get a random number in the range [a, b) or [a, b] depending on rounding.\n"," | \n"," | vonmisesvariate(self, mu, kappa)\n"," | Circular data distribution.\n"," | \n"," | mu is the mean angle, expressed in radians between 0 and 2*pi, and\n"," | kappa is the concentration parameter, which must be greater than or\n"," | equal to zero. If kappa is equal to zero, this distribution reduces\n"," | to a uniform random angle over the range 0 to 2*pi.\n"," | \n"," | weibullvariate(self, alpha, beta)\n"," | Weibull distribution.\n"," | \n"," | alpha is the scale parameter and beta is the shape parameter.\n"," | \n"," | ----------------------------------------------------------------------\n"," | Class methods inherited from Random:\n"," | \n"," | __init_subclass__(**kwargs) from builtins.type\n"," | Control how subclasses generate random integers.\n"," | \n"," | The algorithm a subclass can use depends on the random() and/or\n"," | getrandbits() implementation available to it and determines\n"," | whether it can generate random integers from arbitrarily large\n"," | ranges.\n"," | \n"," | ----------------------------------------------------------------------\n"," | Data descriptors inherited from Random:\n"," | \n"," | __dict__\n"," | dictionary for instance variables (if defined)\n"," | \n"," | __weakref__\n"," | list of weak references to the object (if defined)\n"," | \n"," | ----------------------------------------------------------------------\n"," | Data and other attributes inherited from Random:\n"," | \n"," | VERSION = 3\n"," | \n"," | ----------------------------------------------------------------------\n"," | Static methods inherited from _random.Random:\n"," | \n"," | __new__(*args, **kwargs) from builtins.type\n"," | Create and return a new object. See help(type) for accurate signature.\n","\n","FUNCTIONS\n"," betavariate(alpha, beta) method of Random instance\n"," Beta distribution.\n"," \n"," Conditions on the parameters are alpha > 0 and beta > 0.\n"," Returned values range between 0 and 1.\n"," \n"," choice(seq) method of Random instance\n"," Choose a random element from a non-empty sequence.\n"," \n"," choices(population, weights=None, *, cum_weights=None, k=1) method of Random instance\n"," Return a k sized list of population elements chosen with replacement.\n"," \n"," If the relative weights or cumulative weights are not specified,\n"," the selections are made with equal probability.\n"," \n"," expovariate(lambd) method of Random instance\n"," Exponential distribution.\n"," \n"," lambd is 1.0 divided by the desired mean. It should be\n"," nonzero. (The parameter would be called \"lambda\", but that is\n"," a reserved word in Python.) Returned values range from 0 to\n"," positive infinity if lambd is positive, and from negative\n"," infinity to 0 if lambd is negative.\n"," \n"," gammavariate(alpha, beta) method of Random instance\n"," Gamma distribution. Not the gamma function!\n"," \n"," Conditions on the parameters are alpha > 0 and beta > 0.\n"," \n"," The probability distribution function is:\n"," \n"," x ** (alpha - 1) * math.exp(-x / beta)\n"," pdf(x) = --------------------------------------\n"," math.gamma(alpha) * beta ** alpha\n"," \n"," gauss(mu, sigma) method of Random instance\n"," Gaussian distribution.\n"," \n"," mu is the mean, and sigma is the standard deviation. This is\n"," slightly faster than the normalvariate() function.\n"," \n"," Not thread-safe without a lock around calls.\n"," \n"," getrandbits(k, /) method of Random instance\n"," getrandbits(k) -> x. Generates an int with k random bits.\n"," \n"," getstate() method of Random instance\n"," Return internal state; can be passed to setstate() later.\n"," \n"," lognormvariate(mu, sigma) method of Random instance\n"," Log normal distribution.\n"," \n"," If you take the natural logarithm of this distribution, you'll get a\n"," normal distribution with mean mu and standard deviation sigma.\n"," mu can have any value, and sigma must be greater than zero.\n"," \n"," normalvariate(mu, sigma) method of Random instance\n"," Normal distribution.\n"," \n"," mu is the mean, and sigma is the standard deviation.\n"," \n"," paretovariate(alpha) method of Random instance\n"," Pareto distribution. alpha is the shape parameter.\n"," \n"," randbytes(n) method of Random instance\n"," Generate n random bytes.\n"," \n"," randint(a, b) method of Random instance\n"," Return random integer in range [a, b], including both end points.\n"," \n"," random() method of Random instance\n"," random() -> x in the interval [0, 1).\n"," \n"," randrange(start, stop=None, step=1) method of Random instance\n"," Choose a random item from range(start, stop[, step]).\n"," \n"," This fixes the problem with randint() which includes the\n"," endpoint; in Python this is usually not what you want.\n"," \n"," sample(population, k, *, counts=None) method of Random instance\n"," Chooses k unique random elements from a population sequence or set.\n"," \n"," Returns a new list containing elements from the population while\n"," leaving the original population unchanged. The resulting list is\n"," in selection order so that all sub-slices will also be valid random\n"," samples. This allows raffle winners (the sample) to be partitioned\n"," into grand prize and second place winners (the subslices).\n"," \n"," Members of the population need not be hashable or unique. If the\n"," population contains repeats, then each occurrence is a possible\n"," selection in the sample.\n"," \n"," Repeated elements can be specified one at a time or with the optional\n"," counts parameter. For example:\n"," \n"," sample(['red', 'blue'], counts=[4, 2], k=5)\n"," \n"," is equivalent to:\n"," \n"," sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n"," \n"," To choose a sample from a range of integers, use range() for the\n"," population argument. This is especially fast and space efficient\n"," for sampling from a large population:\n"," \n"," sample(range(10000000), 60)\n"," \n"," seed(a=None, version=2) method of Random instance\n"," Initialize internal state from a seed.\n"," \n"," The only supported seed types are None, int, float,\n"," str, bytes, and bytearray.\n"," \n"," None or no argument seeds from current time or from an operating\n"," system specific randomness source if available.\n"," \n"," If *a* is an int, all bits are used.\n"," \n"," For version 2 (the default), all of the bits are used if *a* is a str,\n"," bytes, or bytearray. For version 1 (provided for reproducing random\n"," sequences from older versions of Python), the algorithm for str and\n"," bytes generates a narrower range of seeds.\n"," \n"," setstate(state) method of Random instance\n"," Restore internal state from object returned by getstate().\n"," \n"," shuffle(x, random=None) method of Random instance\n"," Shuffle list x in place, and return None.\n"," \n"," Optional argument random is a 0-argument function returning a\n"," random float in [0.0, 1.0); if it is the default None, the\n"," standard random.random will be used.\n"," \n"," triangular(low=0.0, high=1.0, mode=None) method of Random instance\n"," Triangular distribution.\n"," \n"," Continuous distribution bounded by given lower and upper limits,\n"," and having a given mode value in-between.\n"," \n"," http://en.wikipedia.org/wiki/Triangular_distribution\n"," \n"," uniform(a, b) method of Random instance\n"," Get a random number in the range [a, b) or [a, b] depending on rounding.\n"," \n"," vonmisesvariate(mu, kappa) method of Random instance\n"," Circular data distribution.\n"," \n"," mu is the mean angle, expressed in radians between 0 and 2*pi, and\n"," kappa is the concentration parameter, which must be greater than or\n"," equal to zero. If kappa is equal to zero, this distribution reduces\n"," to a uniform random angle over the range 0 to 2*pi.\n"," \n"," weibullvariate(alpha, beta) method of Random instance\n"," Weibull distribution.\n"," \n"," alpha is the scale parameter and beta is the shape parameter.\n","\n","DATA\n"," __all__ = ['Random', 'SystemRandom', 'betavariate', 'choice', 'choices...\n","\n","FILE\n"," /usr/lib/python3.10/random.py\n","\n","\n"]}],"source":["help(random)"]},{"cell_type":"markdown","metadata":{"id":"h8XKNCqw7c_A"},"source":["The module's `__file__` attribute gives the location where the module was found in the file system:"]},{"cell_type":"code","execution_count":31,"metadata":{"id":"7sAr-IhR7geW","colab":{"base_uri":"https://localhost:8080/","height":35},"executionInfo":{"status":"ok","timestamp":1710746849050,"user_tz":-480,"elapsed":289,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"d0982334-802a-40a0-b76a-93f6d402dc77"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'/usr/lib/python3.10/random.py'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":31}],"source":["random.__file__"]},{"cell_type":"markdown","metadata":{"id":"wC35N2nM7vJ9"},"source":["Alternatively, we can import all names in a module to the current namespace using the `from` form of the `import` statement:"]},{"cell_type":"code","execution_count":32,"metadata":{"id":"dKwMljvF7ywQ","executionInfo":{"status":"ok","timestamp":1710746901024,"user_tz":-480,"elapsed":536,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[],"source":["from random import *"]},{"cell_type":"markdown","metadata":{"id":"3lHQXYs-8BEa"},"source":["\n","Then we don't need to use the prefix every time we use something from it:\n"]},{"cell_type":"code","execution_count":33,"metadata":{"id":"pi7GSbj18eDv","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746902059,"user_tz":-480,"elapsed":1,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"a5f61570-8a6f-483b-c0f9-49bbba24708d"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["3"]},"metadata":{},"execution_count":33}],"source":["randint(0, 10)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"moPuxp5HjIKX"},"outputs":[],"source":["dir()"]},{"cell_type":"markdown","metadata":{"id":"gPc8Ul-c8ouA"},"source":["However, this should be used with caution, as it would potentially create *name collisions*:"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"fzSy6Jpe8riI","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"error","timestamp":1709824007709,"user_tz":-480,"elapsed":284,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"4304298b-2d28-4710-cbc1-b94f8075adfe"},"outputs":[{"output_type":"error","ename":"TypeError","evalue":"'int' object is not callable","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mrandint\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mrandint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mTypeError\u001b[0m: 'int' object is not callable"]}],"source":["randint = 2\n","randint(0, 10)"]},{"cell_type":"markdown","metadata":{"id":"fWFSqe9V8xFX"},"source":["As a third alternative, we can import only a few selected names from a module by explicitly listing them:"]},{"cell_type":"code","execution_count":34,"metadata":{"id":"i82ePuMB8zdK","executionInfo":{"status":"ok","timestamp":1710746962902,"user_tz":-480,"elapsed":304,"user":{"displayName":"jing wang","userId":"14082445522574457277"}}},"outputs":[],"source":["from random import randint, sample"]},{"cell_type":"code","execution_count":35,"metadata":{"id":"lTwfBNKN815J","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746964215,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"50df607d-0bfe-4b8a-de9c-8fb7eb18bd18"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["8"]},"metadata":{},"execution_count":35}],"source":["randint(0, 10)"]},{"cell_type":"code","execution_count":36,"metadata":{"id":"YUS2ARV684MW","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710746968322,"user_tz":-480,"elapsed":317,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"4ae026e8-7a87-454a-87b8-121ef37a905b"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[40, 69, 15, 10, 66, 35, 47, 99, 38, 82, 80, 94, 43, 41, 34, 8, 81, 62, 32, 91]"]},"metadata":{},"execution_count":36}],"source":["sample(range(100), 20) # help(sample)"]},{"cell_type":"code","execution_count":38,"metadata":{"id":"AB1RbzbgtFR-","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710747216263,"user_tz":-480,"elapsed":2,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"033c84f5-3d2a-4312-d921-edbd3557e8fa"},"outputs":[{"output_type":"stream","name":"stdout","text":["Help on method sample in module random:\n","\n","sample(population, k, *, counts=None) method of random.Random instance\n"," Chooses k unique random elements from a population sequence or set.\n"," \n"," Returns a new list containing elements from the population while\n"," leaving the original population unchanged. The resulting list is\n"," in selection order so that all sub-slices will also be valid random\n"," samples. This allows raffle winners (the sample) to be partitioned\n"," into grand prize and second place winners (the subslices).\n"," \n"," Members of the population need not be hashable or unique. If the\n"," population contains repeats, then each occurrence is a possible\n"," selection in the sample.\n"," \n"," Repeated elements can be specified one at a time or with the optional\n"," counts parameter. For example:\n"," \n"," sample(['red', 'blue'], counts=[4, 2], k=5)\n"," \n"," is equivalent to:\n"," \n"," sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n"," \n"," To choose a sample from a range of integers, use range() for the\n"," population argument. This is especially fast and space efficient\n"," for sampling from a large population:\n"," \n"," sample(range(10000000), 60)\n","\n"]}],"source":["help(sample)"]},{"cell_type":"markdown","metadata":{"id":"OvY9e-3O10Jg"},"source":["If we want to use the module with a different name, we can use `from...import...as` statement."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"YQHlBuQz10Jh"},"outputs":[],"source":["import random as rand\n","\n","rand.randrange(10, 20, 2) #returns a randomly selected element from the specified range."]},{"cell_type":"markdown","metadata":{"id":"TsDOGxpTVtLY"},"source":["We can use the command below to check the installed packages:"]},{"cell_type":"code","execution_count":37,"metadata":{"id":"aeDT9Nh_B2ua","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1710747043042,"user_tz":-480,"elapsed":2547,"user":{"displayName":"jing wang","userId":"14082445522574457277"}},"outputId":"1a73ee93-ae1a-4319-d28e-b913cca57732"},"outputs":[{"output_type":"stream","name":"stdout","text":["Package Version\n","-------------------------------- ---------------------\n","absl-py 1.4.0\n","aiohttp 3.9.3\n","aiosignal 1.3.1\n","alabaster 0.7.16\n","albumentations 1.3.1\n","altair 4.2.2\n","annotated-types 0.6.0\n","anyio 3.7.1\n","appdirs 1.4.4\n","argon2-cffi 23.1.0\n","argon2-cffi-bindings 21.2.0\n","array-record 0.5.0\n","arviz 0.15.1\n","astropy 5.3.4\n","astunparse 1.6.3\n","async-timeout 4.0.3\n","atpublic 4.0\n","attrs 23.2.0\n","audioread 3.0.1\n","autograd 1.6.2\n","Babel 2.14.0\n","backcall 0.2.0\n","beautifulsoup4 4.12.3\n","bidict 0.23.1\n","bigframes 0.24.0\n","bleach 6.1.0\n","blinker 1.4\n","blis 0.7.11\n","blosc2 2.0.0\n","bokeh 3.3.4\n","bqplot 0.12.43\n","branca 0.7.1\n","build 1.1.1\n","CacheControl 0.14.0\n","cachetools 5.3.3\n","catalogue 2.0.10\n","certifi 2024.2.2\n","cffi 1.16.0\n","chardet 5.2.0\n","charset-normalizer 3.3.2\n","chex 0.1.85\n","click 8.1.7\n","click-plugins 1.1.1\n","cligj 0.7.2\n","cloudpathlib 0.16.0\n","cloudpickle 2.2.1\n","cmake 3.27.9\n","cmdstanpy 1.2.1\n","colorcet 3.1.0\n","colorlover 0.3.0\n","colour 0.1.5\n","community 1.0.0b1\n","confection 0.1.4\n","cons 0.4.6\n","contextlib2 21.6.0\n","contourpy 1.2.0\n","cryptography 42.0.5\n","cufflinks 0.17.3\n","cupy-cuda12x 12.2.0\n","cvxopt 1.3.2\n","cvxpy 1.3.3\n","cycler 0.12.1\n","cymem 2.0.8\n","Cython 3.0.9\n","dask 2023.8.1\n","datascience 0.17.6\n","db-dtypes 1.2.0\n","dbus-python 1.2.18\n","debugpy 1.6.6\n","decorator 4.4.2\n","defusedxml 0.7.1\n","distributed 2023.8.1\n","distro 1.7.0\n","dlib 19.24.2\n","dm-tree 0.1.8\n","docutils 0.18.1\n","dopamine-rl 4.0.6\n","duckdb 0.9.2\n","earthengine-api 0.1.393\n","easydict 1.13\n","ecos 2.0.13\n","editdistance 0.6.2\n","eerepr 0.0.4\n","en-core-web-sm 3.7.1\n","entrypoints 0.4\n","et-xmlfile 1.1.0\n","etils 1.7.0\n","etuples 0.3.9\n","exceptiongroup 1.2.0\n","fastai 2.7.14\n","fastcore 1.5.29\n","fastdownload 0.0.7\n","fastjsonschema 2.19.1\n","fastprogress 1.0.3\n","fastrlock 0.8.2\n","filelock 3.13.1\n","fiona 1.9.6\n","firebase-admin 5.3.0\n","Flask 2.2.5\n","flatbuffers 24.3.7\n","flax 0.8.1\n","folium 0.14.0\n","fonttools 4.49.0\n","frozendict 2.4.0\n","frozenlist 1.4.1\n","fsspec 2023.6.0\n","future 0.18.3\n","gast 0.5.4\n","gcsfs 2023.6.0\n","GDAL 3.6.4\n","gdown 4.7.3\n","geemap 0.32.0\n","gensim 4.3.2\n","geocoder 1.38.1\n","geographiclib 2.0\n","geopandas 0.13.2\n","geopy 2.3.0\n","gin-config 0.5.0\n","glob2 0.7\n","google 2.0.3\n","google-ai-generativelanguage 0.4.0\n","google-api-core 2.11.1\n","google-api-python-client 2.84.0\n","google-auth 2.27.0\n","google-auth-httplib2 0.1.1\n","google-auth-oauthlib 1.2.0\n","google-cloud-aiplatform 1.43.0\n","google-cloud-bigquery 3.12.0\n","google-cloud-bigquery-connection 1.12.1\n","google-cloud-bigquery-storage 2.24.0\n","google-cloud-core 2.3.3\n","google-cloud-datastore 2.15.2\n","google-cloud-firestore 2.11.1\n","google-cloud-functions 1.13.3\n","google-cloud-iam 2.14.3\n","google-cloud-language 2.13.3\n","google-cloud-resource-manager 1.12.3\n","google-cloud-storage 2.8.0\n","google-cloud-translate 3.11.3\n","google-colab 1.0.0\n","google-crc32c 1.5.0\n","google-generativeai 0.3.2\n","google-pasta 0.2.0\n","google-resumable-media 2.7.0\n","googleapis-common-protos 1.63.0\n","googledrivedownloader 0.4\n","graphviz 0.20.1\n","greenlet 3.0.3\n","grpc-google-iam-v1 0.13.0\n","grpcio 1.62.1\n","grpcio-status 1.48.2\n","gspread 3.4.2\n","gspread-dataframe 3.3.1\n","gym 0.25.2\n","gym-notices 0.0.8\n","h5netcdf 1.3.0\n","h5py 3.9.0\n","holidays 0.44\n","holoviews 1.17.1\n","html5lib 1.1\n","httpimport 1.3.1\n","httplib2 0.22.0\n","huggingface-hub 0.20.3\n","humanize 4.7.0\n","hyperopt 0.2.7\n","ibis-framework 8.0.0\n","idna 3.6\n","imageio 2.31.6\n","imageio-ffmpeg 0.4.9\n","imagesize 1.4.1\n","imbalanced-learn 0.10.1\n","imgaug 0.4.0\n","importlib_metadata 7.0.2\n","importlib_resources 6.3.0\n","imutils 0.5.4\n","inflect 7.0.0\n","iniconfig 2.0.0\n","intel-openmp 2023.2.4\n","ipyevents 2.0.2\n","ipyfilechooser 0.6.0\n","ipykernel 5.5.6\n","ipyleaflet 0.18.2\n","ipython 7.34.0\n","ipython-genutils 0.2.0\n","ipython-sql 0.5.0\n","ipytree 0.2.2\n","ipywidgets 7.7.1\n","itsdangerous 2.1.2\n","jax 0.4.23\n","jaxlib 0.4.23+cuda12.cudnn89\n","jeepney 0.7.1\n","jieba 0.42.1\n","Jinja2 3.1.3\n","joblib 1.3.2\n","jsonpickle 3.0.3\n","jsonschema 4.19.2\n","jsonschema-specifications 2023.12.1\n","jupyter-client 6.1.12\n","jupyter-console 6.1.0\n","jupyter_core 5.7.2\n","jupyter-server 1.24.0\n","jupyterlab_pygments 0.3.0\n","jupyterlab_widgets 3.0.10\n","kaggle 1.5.16\n","kagglehub 0.2.0\n","keras 2.15.0\n","keyring 23.5.0\n","kiwisolver 1.4.5\n","langcodes 3.3.0\n","launchpadlib 1.10.16\n","lazr.restfulclient 0.14.4\n","lazr.uri 1.0.6\n","lazy_loader 0.3\n","libclang 16.0.6\n","librosa 0.10.1\n","lightgbm 4.1.0\n","linkify-it-py 2.0.3\n","llvmlite 0.41.1\n","locket 1.0.0\n","logical-unification 0.4.6\n","lxml 4.9.4\n","malloy 2023.1067\n","Markdown 3.5.2\n","markdown-it-py 3.0.0\n","MarkupSafe 2.1.5\n","matplotlib 3.7.1\n","matplotlib-inline 0.1.6\n","matplotlib-venn 0.11.10\n","mdit-py-plugins 0.4.0\n","mdurl 0.1.2\n","miniKanren 1.0.3\n","missingno 0.5.2\n","mistune 0.8.4\n","mizani 0.9.3\n","mkl 2023.2.0\n","ml-dtypes 0.2.0\n","mlxtend 0.22.0\n","more-itertools 10.1.0\n","moviepy 1.0.3\n","mpmath 1.3.0\n","msgpack 1.0.8\n","multidict 6.0.5\n","multipledispatch 1.0.0\n","multitasking 0.0.11\n","murmurhash 1.0.10\n","music21 9.1.0\n","natsort 8.4.0\n","nbclassic 1.0.0\n","nbclient 0.10.0\n","nbconvert 6.5.4\n","nbformat 5.10.2\n","nest-asyncio 1.6.0\n","networkx 3.2.1\n","nibabel 4.0.2\n","nltk 3.8.1\n","notebook 6.5.5\n","notebook_shim 0.2.4\n","numba 0.58.1\n","numexpr 2.9.0\n","numpy 1.25.2\n","oauth2client 4.1.3\n","oauthlib 3.2.2\n","opencv-contrib-python 4.8.0.76\n","opencv-python 4.8.0.76\n","opencv-python-headless 4.9.0.80\n","openpyxl 3.1.2\n","opt-einsum 3.3.0\n","optax 0.2.1\n","orbax-checkpoint 0.4.4\n","osqp 0.6.2.post8\n","packaging 24.0\n","pandas 1.5.3\n","pandas-datareader 0.10.0\n","pandas-gbq 0.19.2\n","pandas-stubs 1.5.3.230304\n","pandocfilters 1.5.1\n","panel 1.3.8\n","param 2.0.2\n","parso 0.8.3\n","parsy 2.1\n","partd 1.4.1\n","pathlib 1.0.1\n","patsy 0.5.6\n","peewee 3.17.1\n","pexpect 4.9.0\n","pickleshare 0.7.5\n","Pillow 9.4.0\n","pip 23.1.2\n","pip-tools 6.13.0\n","platformdirs 4.2.0\n","plotly 5.15.0\n","plotnine 0.12.4\n","pluggy 1.4.0\n","polars 0.20.2\n","pooch 1.8.1\n","portpicker 1.5.2\n","prefetch-generator 1.0.3\n","preshed 3.0.9\n","prettytable 3.10.0\n","proglog 0.1.10\n","progressbar2 4.2.0\n","prometheus_client 0.20.0\n","promise 2.3\n","prompt-toolkit 3.0.43\n","prophet 1.1.5\n","proto-plus 1.23.0\n","protobuf 3.20.3\n","psutil 5.9.5\n","psycopg2 2.9.9\n","ptyprocess 0.7.0\n","py-cpuinfo 9.0.0\n","py4j 0.10.9.7\n","pyarrow 14.0.2\n","pyarrow-hotfix 0.6\n","pyasn1 0.5.1\n","pyasn1-modules 0.3.0\n","pycocotools 2.0.7\n","pycparser 2.21\n","pydantic 2.6.4\n","pydantic_core 2.16.3\n","pydata-google-auth 1.8.2\n","pydot 1.4.2\n","pydot-ng 2.0.0\n","pydotplus 2.0.2\n","PyDrive 1.3.1\n","PyDrive2 1.6.3\n","pyerfa 2.0.1.1\n","pygame 2.5.2\n","Pygments 2.16.1\n","PyGObject 3.42.1\n","PyJWT 2.3.0\n","pymc 5.10.4\n","pymystem3 0.2.0\n","PyOpenGL 3.1.7\n","pyOpenSSL 24.1.0\n","pyparsing 3.1.2\n","pyperclip 1.8.2\n","pyproj 3.6.1\n","pyproject_hooks 1.0.0\n","pyshp 2.3.1\n","PySocks 1.7.1\n","pytensor 2.18.6\n","pytest 7.4.4\n","python-apt 0.0.0\n","python-box 7.1.1\n","python-dateutil 2.8.2\n","python-louvain 0.16\n","python-slugify 8.0.4\n","python-utils 3.8.2\n","pytz 2023.4\n","pyviz_comms 3.0.1\n","PyWavelets 1.5.0\n","PyYAML 6.0.1\n","pyzmq 23.2.1\n","qdldl 0.1.7.post0\n","qudida 0.0.4\n","ratelim 0.1.6\n","referencing 0.33.0\n","regex 2023.12.25\n","requests 2.31.0\n","requests-oauthlib 1.4.0\n","requirements-parser 0.5.0\n","rich 13.7.1\n","rpds-py 0.18.0\n","rpy2 3.4.2\n","rsa 4.9\n","safetensors 0.4.2\n","scikit-image 0.19.3\n","scikit-learn 1.2.2\n","scipy 1.11.4\n","scooby 0.9.2\n","scs 3.2.4.post1\n","seaborn 0.13.1\n","SecretStorage 3.3.1\n","Send2Trash 1.8.2\n","sentencepiece 0.1.99\n","setuptools 67.7.2\n","shapely 2.0.3\n","six 1.16.0\n","sklearn-pandas 2.2.0\n","smart-open 6.4.0\n","sniffio 1.3.1\n","snowballstemmer 2.2.0\n","sortedcontainers 2.4.0\n","soundfile 0.12.1\n","soupsieve 2.5\n","soxr 0.3.7\n","spacy 3.7.4\n","spacy-legacy 3.0.12\n","spacy-loggers 1.0.5\n","Sphinx 5.0.2\n","sphinxcontrib-applehelp 1.0.8\n","sphinxcontrib-devhelp 1.0.6\n","sphinxcontrib-htmlhelp 2.0.5\n","sphinxcontrib-jsmath 1.0.1\n","sphinxcontrib-qthelp 1.0.7\n","sphinxcontrib-serializinghtml 1.1.10\n","SQLAlchemy 2.0.28\n","sqlglot 20.11.0\n","sqlparse 0.4.4\n","srsly 2.4.8\n","stanio 0.3.0\n","statsmodels 0.14.1\n","sympy 1.12\n","tables 3.8.0\n","tabulate 0.9.0\n","tbb 2021.11.0\n","tblib 3.0.0\n","tenacity 8.2.3\n","tensorboard 2.15.2\n","tensorboard-data-server 0.7.2\n","tensorflow 2.15.0\n","tensorflow-datasets 4.9.4\n","tensorflow-estimator 2.15.0\n","tensorflow-gcs-config 2.15.0\n","tensorflow-hub 0.16.1\n","tensorflow-io-gcs-filesystem 0.36.0\n","tensorflow-metadata 1.14.0\n","tensorflow-probability 0.23.0\n","tensorstore 0.1.45\n","termcolor 2.4.0\n","terminado 0.18.1\n","text-unidecode 1.3\n","textblob 0.17.1\n","tf_keras 2.15.1\n","tf-slim 1.1.0\n","thinc 8.2.3\n","threadpoolctl 3.3.0\n","tifffile 2024.2.12\n","tinycss2 1.2.1\n","tokenizers 0.15.2\n","toml 0.10.2\n","tomli 2.0.1\n","toolz 0.12.1\n","torch 2.2.1+cu121\n","torchaudio 2.2.1+cu121\n","torchdata 0.7.1\n","torchsummary 1.5.1\n","torchtext 0.17.1\n","torchvision 0.17.1+cu121\n","tornado 6.3.3\n","tqdm 4.66.2\n","traitlets 5.7.1\n","traittypes 0.2.1\n","transformers 4.38.2\n","triton 2.2.0\n","tweepy 4.14.0\n","typer 0.9.0\n","types-pytz 2024.1.0.20240203\n","types-setuptools 69.1.0.20240310\n","typing_extensions 4.10.0\n","tzlocal 5.2\n","uc-micro-py 1.0.3\n","uritemplate 4.1.1\n","urllib3 2.0.7\n","vega-datasets 0.9.0\n","wadllib 1.3.6\n","wasabi 1.1.2\n","wcwidth 0.2.13\n","weasel 0.3.4\n","webcolors 1.13\n","webencodings 0.5.1\n","websocket-client 1.7.0\n","Werkzeug 3.0.1\n","wheel 0.43.0\n","widgetsnbextension 3.6.6\n","wordcloud 1.9.3\n","wrapt 1.14.1\n","xarray 2023.7.0\n","xarray-einstats 0.7.0\n","xgboost 2.0.3\n","xlrd 2.0.1\n","xyzservices 2023.10.1\n","yarl 1.9.4\n","yellowbrick 1.5\n","yfinance 0.2.37\n","zict 3.0.0\n","zipp 3.18.0\n"]}],"source":["! pip list # packages are listed in a case-insensitive sorted order"]},{"cell_type":"markdown","metadata":{"id":"99mM9eJj4v2J"},"source":["
\n","\n","---\n","\n","
\n","\n","# Appendix: Python Statements (Updated)\n","\n","\n","\n","\n","|Statement|Role|Example\n","|:-- |:-- |:-- |\n","|Assignment: `=`|Creating and assigning references|`a, b = 'good', 'bad'`
`ls = [1, 5]; ls[1] = 2; ls[2:2] = [3, 4]` |\n","|Augmented assignment:
`+=`, `-=`, `*=`, `/=`, `%=`, etc.| Combining a binary operation and
an assignment statement|`a *= 2`
`a += b` |\n","|`del`|Deleting references|`del variable`
`del object.attribute`
`del data[index]`
`del data[index:index]`|\n","|`if/elif/else`| Selecting actions|`if \"python\":`
    `print(\"programming\")` |\n","|`for`| Definite loops |`for x in \"python\":`
     `print(x)` |\n","|`while`| Indefinite/general loops |`while x > 0:`
        `print(\"positive\")` |\n","|`break`| Loop exit |`while True:`
        `if exittest(): break` |\n","|`continue`| Loop continue |`while True:`
        `if skiptest(): continue` |\n","|`try/except/finally`| Catching exceptions |`try:`
        `action()`
`except:`
        `print('action error')` |\n","|`def`| Creating functions |`def f(a, b, c=1, *d):`
        ` print(a+b+c+d[0])` |\n","|`return`| Specifying return values |`def f(a, b, c=1, *d):`
        ` return a+b+c+d[0]` |\n","|`class`| Creating classes |`class Subclass(Superclass):`

            `data_attr = []`

            `def fun_attr(self):`
                     `pass` |\n","|`import/from`| Module access or attribute access from a module | `import random`
`from random import randint` |\n","\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"uXb4NiaTjIKY"},"outputs":[],"source":[]}],"metadata":{"colab":{"provenance":[]},"hide_input":false,"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.7.1"},"toc":{"base_numbering":1,"nav_menu":{},"number_sections":false,"sideBar":true,"skip_h1_title":false,"title_cell":"Table of Contents","title_sidebar":"Contents","toc_cell":false,"toc_position":{},"toc_section_display":true,"toc_window_display":false}},"nbformat":4,"nbformat_minor":0} \ No newline at end of file diff --git a/course_materials/Topic_5_1_Web_Scraping_Beautiful_Soup_(with answers).ipynb b/course_materials/Topic_5_1_Web_Scraping_Beautiful_Soup_(with answers).ipynb new file mode 100644 index 0000000..693c09e --- /dev/null +++ b/course_materials/Topic_5_1_Web_Scraping_Beautiful_Soup_(with answers).ipynb @@ -0,0 +1,15639 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + " ### Disclaimer: Please note that the instructions for Web scraping in this file are tailored for the Chrome browser, and may not be applicable to other browsers. We recommend using Chrome for best results. \n", + "\n", + " [Chrome Download Link](https://www.google.com/chrome/)" + ], + "metadata": { + "id": "hIiXWy39FRoA" + } + }, + { + "cell_type": "markdown", + "metadata": { + "id": "vIb0Iv2pcVdS" + }, + "source": [ + "# [Trump's Lies](https://www.nytimes.com/interactive/2017/06/23/opinion/trumps-lies.html)\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5qmLbuMYWbxb" + }, + "source": [ + "How to open the Chrome's developer tools (or devtools):\n", + "\n", + "- Press F12 on the keyboard (sometimes Fn + F12)\n", + "- Right-click on a Web page → Inspect\n", + "- Choose at the top right corner of the Chrome window → More tools → Developers tool (or Ctrl or Command + Shift + I)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "kKjtPYWHcVdY" + }, + "source": [ + "\n", + "---\n", + "\n", + "\n", + "# Web Scraping\n", + "\n", + "\n", + "Using the Python programming language, it is possible to \"scrape\" data from the Web in a quick and efficient manner.\n", + "\n", + "**Web Scraping** commonly refers to the practice of writing an automated program\n", + "that queries a web server, requests data (usually in the form of HTML and other files\n", + "that compose web pages), and then parses that data to extract needed information.\n", + "\n", + "\n", + "\n", + "Web scraping is a valuable tool in the data scientist's skill set.\n", + "\n", + "- [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/) Beautiful Soup is a Python library designed for quick turnaround projects like screen-scraping. It is a toolkit for parsing documents and extracting the necessary data.\n", + "- [Selenium](https://www.selenium.dev) Selenium is an open source umbrella project encompassing a range of tools and libraries designed to facilitate browser automation. It enables the simulation of a wide range of manual actions within browsers.\n", + "\n", + "

\n", + "\n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "oq_AQVAlcVdZ" + }, + "source": [ + "---\n", + "
\n", + "\n", + "# HTML Basics\n", + "\n", + "\n", + "\n", + "[**HyperText Markup Language**](https://developer.mozilla.org/en-US/docs/Web/HTML) (HTML for short) is a markup language for describing Web documents.\n", + "\n", + "\n", + "It is plain text, but includes a rich collection of \"tags\" that define the structure of the document and allow documents to include a variety of page elements.\n", + "\n", + "- Tags are always enclosed in angle brackets: ` `.\n", + "\n", + "\n", + "\n", + "- Tags usually travel in pairs and contain something in between. An opening (or start) tag begins a section of page content, and a closing (or end) tag ends it, e.g., `content`.\n", + "\n", + " - [`

`, `

`, ..., `

`](https://www.w3schools.com/tags/tag_hn.asp): largest headings, second largest headings, etc.;\n", + "\n", + " - [`

`](https://www.w3schools.com/tags/tag_p.asp): paragraphs;\n", + "\n", + " - [`

    `](https://www.w3schools.com/tags/tag_ul.asp) or [`
      `](https://www.w3schools.com/tags/tag_ol.asp): unordered or ordered bulleted lists;\n", + "\n", + " - [`
    1. `](https://www.w3schools.com/tags/tag_li.asp): individual list items;\n", + "\n", + " - [`
      `](https://www.w3schools.com/tags/tag_div.asp): divisions or sections;\n", + "\n", + " - [``](https://www.w3schools.com/tags/tag_a.asp): anchors;\n", + "\n", + " - and [many others ...](https://www.w3schools.com/tags/default.asp)\n", + "\n", + " \n" + ] + }, + { + "cell_type": "markdown", + "source": [ + "---\n", + "- There are also a few *self-closing* tags, e.g.:\n", + "\n", + " - [`
      `](https://www.w3schools.com/tags/tag_br.asp)\n", + "\n", + " - ```html\n", + " \"UST\n", + " ```\n", + " See [``](https://www.w3schools.com/tags/tag_img.asp)\n", + "\n", + "\n", + "- Tags can have attributes, which are always specified in the start tag and come in `name=\"value\"` pairs. E.g.:\n", + "\n", + " - ```html\n", + "
      Python documentation\n", + " ```\n", + " See [``](https://www.w3schools.com/tags/tag_a.asp)\n", + " \n", + " \n" + ], + "metadata": { + "id": "7gfIvMoo0c8m" + } + }, + { + "cell_type": "markdown", + "source": [ + "**Question**:\n", + "\n", + "\n", + "*Excerise*: Please try to write a html file with the layout shown below. Name it as try.html and open it with your web browser. Alternatively, you can use [HTML Tryit editor on W3Schools](https://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro) to run your code.\n", + "\n", + "\n", + "\n", + "\n", + "- The text on the page is as follows:\n", + "\n", + " Countries of the World: A Simple Example\n", + "\n", + " Andorra\n", + "\n", + " - Capital: Andorra la Vella\n", + " - Population: 84000\n", + " - Area (km^2): 468.0\n", + "\n", + "- The image address: https://upload.wikimedia.org/wikipedia/commons/5/5b/Andorra_la_Vella_-_view2.jpg\n", + "\n", + "\n", + "\n", + "- Tags you may want to enclose in the `` tag includes: `

      `, `

      `, `
      `, `
        `, `
      1. `, and ``\n", + "\n" + ], + "metadata": { + "id": "OzhKAsygXlg4" + } + }, + { + "cell_type": "markdown", + "source": [ + "- There are a few attributes that are common to all tags, among which the two most used ones are `id` and `class`:\n", + "\n", + " - [`id`](https://www.w3schools.com/html/html_id.asp) allows us to specify a unique identifier for an element which must be unique in the whole document. E.g.:\n", + " \n", + " - ```html\n", + "

        This is a paragraph with id \"unique-one\".

        \n", + " ``` \n", + "\n", + " - [`class`](https://www.w3schools.com/html/html_classes.asp) allows us to assign multiple elements (possibly of different types) to the same group identified by a class name. E.g.:\n", + "\n", + " - ```html\n", + "

        This is a paragraph of class \"class-one\".

        \n", + " ```\n", + "\n", + " - An element can also be assigned to multiple groups that are specified by a *space-separated* list of class names. E.g.:\n", + " \n", + " - ```html\n", + "
        Some Content
        \n", + " ```\n", + "- In Web scraping, the `class` and/or `id` attributes can be leveraged to differentiate the section we want from other sections. To do so, we need to use something called the **CSS selector**." + ], + "metadata": { + "id": "uTjtaZrnXhqh" + } + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PwV6SAKTWbxg" + }, + "source": [ + "---\n", + "\n", + "
        \n", + "\n", + "## CSS Basics\n", + "\n", + "\n", + "[**Cascading Style Sheets**](https://developer.mozilla.org/en-US/docs/Web/CSS) (CSS for short) is a style sheet language for describing the presentation of a document written in a markup language.\n", + "\n", + "HTML dictates the content and structure of a webpage, while CSS modifies design and display of HTML elements.\n", + "\n", + "\n", + "\n", + "\n", + "[3 ways](https://www.w3schools.com/css/css_howto.asp) of creating and applying CSS rules:\n", + "\n", + "- An inline style created right on an HTML start tag, using `style=\"attribute: value;\"`;\n", + "\n", + "- An [embedded/internal style sheet](https://jwang.people.ust.hk/sample_embeddedCSS.html) included by a `\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
        datelieexplanationurl
        0Jan. 21I wasn't a fan of Iraq. I didn't want to go in...He was for an invasion before he was against it.https://www.buzzfeed.com/andrewkaczynski/in-20...
        1Jan. 21A reporter for Time magazine — and I have been...Trump was on the cover 11 times and Nixon appe...http://nation.time.com/2013/11/06/10-things-yo...
        2Jan. 23Between 3 million and 5 million illegal votes ...There's no evidence of illegal voting.https://www.nytimes.com/2017/01/23/us/politics...
        3Jan. 25Now, the audience was the biggest ever. But th...Official aerial photos show Obama's 2009 inaug...https://www.nytimes.com/2017/01/21/us/politics...
        4Jan. 25Take a look at the Pew reports (which show vot...The report never mentioned voter fraud.https://www.nytimes.com/2017/01/24/us/politics...
        ...............
        175Oct. 25We have trade deficits with almost everybody.We have trade surpluses with more than 100 cou...https://www.bea.gov/newsreleases/international...
        176Oct. 27Wacky & totally unhinged Tom Steyer, who has b...Steyer has financially supported many winning ...https://www.opensecrets.org/donor-lookup/resul...
        177Nov. 1Again, we're the highest-taxed nation, just ab...We're not.http://www.politifact.com/truth-o-meter/statem...
        178Nov. 7When you look at the city with the strongest g...Several other cities, including New York and L...http://www.politifact.com/truth-o-meter/statem...
        179Nov. 11I'd rather have him – you know, work with him...There is no evidence that Democrats \"set up\" R...https://www.nytimes.com/interactive/2017/12/10...
        \n", + "

        180 rows × 4 columns

        \n", + "

      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + " \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "lie_df", + "summary": "{\n \"name\": \"lie_df\",\n \"rows\": 180,\n \"fields\": [\n {\n \"column\": \"date\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 91,\n \"samples\": [\n \"April 28\",\n \"March 7\",\n \"June 23\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"lie\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 179,\n \"samples\": [\n \"I think our side's been proven very strongly. And everybody's talking about it.\",\n \"It's gotten to a point where it is not even being reported. And in many cases, the very, very dishonest press doesn't want to report it.\",\n \"Someone should look into who paid for the small organized rallies yesterday. The election is over!\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"explanation\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 140,\n \"samples\": [\n \"Many experts predicted that.\",\n \"China stopped in 2014.\",\n \"Trump implied there was a terror attack in Sweden, but there was no such attack.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"url\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 116,\n \"samples\": [\n \"https://www.nytimes.com/interactive/2017/10/12/us/politics/trump-border-claim-factcheck.html?_r=0\",\n \"https://www.nytimes.com/2017/01/24/us/politics/unauthorized-immigrant-voting-trump-lie.html\",\n \"https://www.nytimes.com/2017/03/23/us/politics/fact-check-trump-misleads-surveillance-wiretapping.html\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 42 + } + ], + "source": [ + "import pandas as pd\n", + "lie_df = pd.DataFrame({'date': date_list, 'lie': lie_list, 'explanation': explanation_list, 'url': url_list})\n", + "lie_df" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "cD3G0wjEcVdw" + }, + "source": [ + "Save the output in the file system:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "g4qKJo9scVdw" + }, + "outputs": [], + "source": [ + "lie_df.to_csv('trump_lies.csv')" + ] + }, + { + "cell_type": "markdown", + "source": [ + "---\n", + "## Another Example: Scraping Textual Data from IMDB website\n", + "\n", + "1. We first need to use `requests.get(url)` to connect to the website and name the response as `film_response`" + ], + "metadata": { + "id": "J50MA9rzsbHF" + } + }, + { + "cell_type": "code", + "source": [ + "from bs4 import BeautifulSoup\n", + "from bs4.formatter import HTMLFormatter\n", + "import requests\n", + "\n", + "# open the URL; set timeout to 3 seconds; set a User-Agent that mimics a real browser in your request header.\n", + "film_response = requests.get(\"https://www.imdb.com/search/title/?sort=num_votes,desc&start=1&title_type=feature&year=1950,2021\", timeout=3, headers={'User-Agent':'Mozilla/5.0'})" + ], + "metadata": { + "id": "UgdU9dHDsf_g" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + " 2. Next please make a `BeautifulSoup` object with what is held by the `.content` attribute of the response and name it as `bs_films`" + ], + "metadata": { + "id": "VjMKcMzfuCfo" + } + }, + { + "cell_type": "code", + "source": [ + "# write your code here\n", + "bs_films = BeautifulSoup(film_response.content, 'html.parser')" + ], + "metadata": { + "id": "uUblyjR4uETL" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(bs_films.prettify())" + ], + "metadata": { + "id": "FoevMY4nuXXN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4a13b202-8924-446a-9ba0-65681bded863" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " Advanced search\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \"\"\n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " Advanced search\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
    2. \n", + " \n", + " \n", + " \n", + " \n", + "
    3. \n", + "
        \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " TITLES\n", + " \n", + "
      • \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " NAMES\n", + " \n", + "
      • \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " COLLABORATIONS\n", + " \n", + "
      • \n", + "
      • \n", + "
      • \n", + "
      \n", + "
    4. \n", + " \n", + " \n", + " \n", + " \n", + "
    5. \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " Search filters\n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " Enter full date\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " or just enter yyyy, or yyyy-mm below\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "

      \n", + " Exclude\n", + "

      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " Only includes titles with the selected topics\n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " In minutes\n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " to\n", + "

      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " 1-50 of 453,111\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " Recently viewed\n", + "

      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + " You have no recently viewed pages\n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "\n", + "\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "3. In the HTML code, every record is surrounded by the `
      ` tag of `class=\"sc-d80c3c78-4 kXzHjH dli-parent`, we can use `find_all` to select the records and name it as `film_list`\n", + "\n", + "```html\n", + "
      \n", + " contents\n", + "
      \n", + "```\n", + "**Note**: The class attributes of HTML elements may vary depending on when you access the webpage and which browser you are using. Please ensure to verify and update the class selectors in your code accordingly to accommodate these potential variations." + ], + "metadata": { + "id": "o9ycToX4ugZm" + } + }, + { + "cell_type": "code", + "source": [ + "# write your code here; consider matching based on class `dli-parent` only\n", + "film_list = bs_films.find_all('div',{'class':'dli-parent'})" + ], + "metadata": { + "id": "JuAU37SVu-Tf" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "film_list = bs_films.select('div.dli-parent')" + ], + "metadata": { + "id": "a6TlY_LA759m" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "This returns a list of all tags that match the given criteria:" + ], + "metadata": { + "id": "LI-48SQtvAo2" + } + }, + { + "cell_type": "code", + "source": [ + "len(film_list)" + ], + "metadata": { + "id": "UodqL78_64ie", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "643afa7e-c941-4004-d624-ff0727dd31c1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "50" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "film_list[0]" + ], + "metadata": { + "id": "-l0Mn2F7vDA-", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c862b3d3-eaa3-43e1-9d33-9f8e5657bc9d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "
      \"Tim
      19942h 22mR
      9.3 (2.9M)
      82Metascore
      Over the course of several years, two convicts form a friendship, seeking consolation and, eventually, redemption through basic compassion.
      " + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "There is still a lot of information in each records, and the information is enclosed by different tags, such as `
      ` or `` or `` tags.\n", + "\n", + "For example, the film name field has the following HTML structure.\n", + "\n", + "```html\n", + "

      Rank. Name

      \n", + "```" + ], + "metadata": { + "id": "DMqLvzvsvPkw" + } + }, + { + "cell_type": "markdown", + "source": [ + "4. To get the information about film name, we can combining `find`, `.contents` and list indexing." + ], + "metadata": { + "id": "cU85s5muvUqh" + } + }, + { + "cell_type": "code", + "source": [ + "film_list[0].find('h3')" + ], + "metadata": { + "id": "puph7WtmvXWI", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "8da54e4b-e800-42e3-f3ca-3b8d496be518" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "

      1. The Shawshank Redemption

      " + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "film_list[0].find('h3').get_text()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "DrZUgXyZ7cvy", + "outputId": "e5f6d427-366c-4600-9941-12db2c88669e" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'1. The Shawshank Redemption'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 10 + } + ] + }, + { + "cell_type": "code", + "source": [ + "rank_name = film_list[0].find('h3').get_text()\n", + "rank_name" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "SCm9RxN48vnF", + "outputId": "9472d507-b73e-4db8-f322-d002435c7901" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'1. The Shawshank Redemption'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "code", + "source": [ + "rank_name[3:]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "B0unmeW580im", + "outputId": "3090502b-450c-4790-e0ee-b308e0aede62" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'The Shawshank Redemption'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 12 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "**Question**: how to extract the film name only, i.e., remove the rank?" + ], + "metadata": { + "id": "dpoDUxVF1LD1" + } + }, + { + "cell_type": "code", + "source": [ + "#try here\n", + "rank_name[rank_name.index('.')+2:]" + ], + "metadata": { + "id": "uJD16KmC1V-X", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "1e994117-1b45-40be-9404-b48e82d088a6" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'The Shawshank Redemption'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "rank_name[:rank_name.index('.')]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "Y3A3v2K9-cRW", + "outputId": "2582897a-ac7e-4a23-ca9c-3e55c0a724ae" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'1'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "5. Next, let's get the rating of the film. Remember you also tried to identify the HTML tag yourself, compare your findings with what follows\n", + "\n", + "*Exercise:* Try to identify the tags around the film ratings by using Chrome inspection tool.\n", + "\n", + "Hint: Rating is enclosed by `` tags" + ], + "metadata": { + "id": "BEOx-MxEv3N4" + } + }, + { + "cell_type": "code", + "source": [ + "#write your code here\n", + "film_list[0].find('span', {'class':'ipc-rating-star'}).contents[1]" + ], + "metadata": { + "id": "YX4_rMvfv5bk", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "76035bb7-c8d7-451d-fae7-7d3d538cd6ff" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'9.3'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 17 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "6. For the description, select the text within the `
      ` tag" + ], + "metadata": { + "id": "-oEnS7Hyv-Og" + } + }, + { + "cell_type": "code", + "source": [ + "#write your code here\n", + "\n", + "film_list[0].find('div', {'class':'ipc-html-content'}).get_text()" + ], + "metadata": { + "id": "ECOPT9MLwFEj", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "outputId": "85219243-7fb3-47cf-d968-5610954c4150" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'Over the course of several years, two convicts form a friendship, seeking consolation and, eventually, redemption through basic compassion.'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 19 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "7. Finally, we extend this process to all the rest of it using a `for` loop:" + ], + "metadata": { + "id": "s0TMDS2CwRg8" + } + }, + { + "cell_type": "code", + "source": [ + "film_names=[]\n", + "descripts=[]\n", + "ratings=[]\n", + "\n", + "for film in film_list:\n", + " # write your code here\n", + " rank_name = film.find('h3').get_text()\n", + " film_names.append(rank_name[rank_name.index('.')+2:])\n", + " descripts.append(film.find('div', {'class':'ipc-html-content'}).get_text())\n", + " ratings.append(film.find('span', {'class':'ipc-rating-star'}).contents[1])" + ], + "metadata": { + "id": "N20XjfukwUky" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "print(film_names)" + ], + "metadata": { + "id": "Qra9256kwfyL", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fb6e41b3-0851-4422-86fc-307ea5150596" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['The Shawshank Redemption', 'The Dark Knight', 'Inception', 'Fight Club', 'Forrest Gump', 'Pulp Fiction', 'Interstellar', 'The Matrix', 'The Godfather', 'The Lord of the Rings: The Fellowship of the Ring', 'The Lord of the Rings: The Return of the King', 'The Dark Knight Rises', 'Se7en', 'The Lord of the Rings: The Two Towers', 'Django Unchained', 'Gladiator', 'Inglourious Basterds', 'The Wolf of Wall Street', 'Batman Begins', 'The Silence of the Lambs', 'Saving Private Ryan', 'Joker', 'The Avengers', 'Shutter Island', 'Star Wars: Episode IV - A New Hope', \"Schindler's List\", 'The Prestige', 'The Departed', 'The Green Mile', 'Avatar', 'Star Wars: Episode V - The Empire Strikes Back', 'The Godfather Part II', 'Memento', 'Back to the Future', 'Titanic', 'Guardians of the Galaxy', 'Avengers: Endgame', 'Goodfellas', 'Léon: The Professional', 'American Beauty', 'Pirates of the Caribbean: The Curse of the Black Pearl', 'Avengers: Infinity War', 'WALL·E', 'The Truman Show', 'Kill Bill: Vol. 1', 'American History X', 'V for Vendetta', 'Terminator 2: Judgment Day', 'The Usual Suspects', 'The Lion King']\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "10. We can now combine the data into a pandas `DataFrame` (a tabular data model that makes data manipulation and analysis easy; we'll learn more about pandas later) and name it as `best_film_df` for future analyses:" + ], + "metadata": { + "id": "YGBMDy1Awhbx" + } + }, + { + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "#write your code here\n", + "best_film_df = pd.DataFrame({'name':film_names, 'rating':ratings, 'description':descripts})\n", + "best_film_df" + ], + "metadata": { + "id": "2nAY3hb_wjLG", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1000 + }, + "outputId": "b7ee1ca6-a32a-45ea-e04b-bffe33e960fd" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " name rating \\\n", + "0 The Shawshank Redemption 9.3 \n", + "1 The Dark Knight 9.0 \n", + "2 Inception 8.8 \n", + "3 Fight Club 8.8 \n", + "4 Forrest Gump 8.8 \n", + "5 Pulp Fiction 8.9 \n", + "6 Interstellar 8.7 \n", + "7 The Matrix 8.7 \n", + "8 The Godfather 9.2 \n", + "9 The Lord of the Rings: The Fellowship of the Ring 8.9 \n", + "10 The Lord of the Rings: The Return of the King 9.0 \n", + "11 The Dark Knight Rises 8.4 \n", + "12 Se7en 8.6 \n", + "13 The Lord of the Rings: The Two Towers 8.8 \n", + "14 Django Unchained 8.5 \n", + "15 Gladiator 8.5 \n", + "16 Inglourious Basterds 8.4 \n", + "17 The Wolf of Wall Street 8.2 \n", + "18 Batman Begins 8.2 \n", + "19 The Silence of the Lambs 8.6 \n", + "20 Saving Private Ryan 8.6 \n", + "21 Joker 8.4 \n", + "22 The Avengers 8.0 \n", + "23 Shutter Island 8.2 \n", + "24 Star Wars: Episode IV - A New Hope 8.6 \n", + "25 Schindler's List 9.0 \n", + "26 The Prestige 8.5 \n", + "27 The Departed 8.5 \n", + "28 The Green Mile 8.6 \n", + "29 Avatar 7.9 \n", + "30 Star Wars: Episode V - The Empire Strikes Back 8.7 \n", + "31 The Godfather Part II 9.0 \n", + "32 Memento 8.4 \n", + "33 Back to the Future 8.5 \n", + "34 Titanic 7.9 \n", + "35 Guardians of the Galaxy 8.0 \n", + "36 Avengers: Endgame 8.4 \n", + "37 Goodfellas 8.7 \n", + "38 Léon: The Professional 8.5 \n", + "39 American Beauty 8.3 \n", + "40 Pirates of the Caribbean: The Curse of the Bla... 8.1 \n", + "41 Avengers: Infinity War 8.4 \n", + "42 WALL·E 8.4 \n", + "43 The Truman Show 8.2 \n", + "44 Kill Bill: Vol. 1 8.2 \n", + "45 American History X 8.5 \n", + "46 V for Vendetta 8.2 \n", + "47 Terminator 2: Judgment Day 8.6 \n", + "48 The Usual Suspects 8.5 \n", + "49 The Lion King 8.5 \n", + "\n", + " description \n", + "0 Over the course of several years, two convicts... \n", + "1 When the menace known as the Joker wreaks havo... \n", + "2 A thief who steals corporate secrets through t... \n", + "3 An insomniac office worker and a devil-may-car... \n", + "4 The history of the United States from the 1950... \n", + "5 The lives of two mob hitmen, a boxer, a gangst... \n", + "6 When Earth becomes uninhabitable in the future... \n", + "7 When a beautiful stranger leads computer hacke... \n", + "8 The aging patriarch of an organized crime dyna... \n", + "9 A meek Hobbit from the Shire and eight compani... \n", + "10 Gandalf and Aragorn lead the World of Men agai... \n", + "11 Eight years after the Joker's reign of chaos, ... \n", + "12 Two detectives, a rookie and a veteran, hunt a... \n", + "13 While Frodo and Sam edge closer to Mordor with... \n", + "14 With the help of a German bounty-hunter, a fre... \n", + "15 A former Roman General sets out to exact venge... \n", + "16 In Nazi-occupied France during World War II, a... \n", + "17 Based on the true story of Jordan Belfort, fro... \n", + "18 After witnessing his parents' death, Bruce lea... \n", + "19 A young F.B.I. cadet must receive the help of ... \n", + "20 Following the Normandy Landings, a group of U.... \n", + "21 During the 1980s, a failed stand-up comedian i... \n", + "22 Earth's mightiest heroes must come together an... \n", + "23 Teddy Daniels and Chuck Aule, two US marshals,... \n", + "24 Luke Skywalker joins forces with a Jedi Knight... \n", + "25 In German-occupied Poland during World War II,... \n", + "26 After a tragic accident, two stage magicians i... \n", + "27 An undercover cop and a mole in the police att... \n", + "28 A tale set on death row, where gentle giant Jo... \n", + "29 A paraplegic Marine dispatched to the moon Pan... \n", + "30 After the Rebels are overpowered by the Empire... \n", + "31 The early life and career of Vito Corleone in ... \n", + "32 A man with short-term memory loss attempts to ... \n", + "33 Marty McFly, a 17-year-old high school student... \n", + "34 A seventeen-year-old aristocrat falls in love ... \n", + "35 A group of intergalactic criminals must pull t... \n", + "36 After the devastating events of Avengers: Infi... \n", + "37 The story of Henry Hill and his life in the ma... \n", + "38 12-year-old Mathilda is reluctantly taken in b... \n", + "39 A sexually frustrated suburban father has a mi... \n", + "40 Blacksmith Will Turner teams up with eccentric... \n", + "41 The Avengers and their allies must be willing ... \n", + "42 In the distant future, a small waste-collectin... \n", + "43 An insurance salesman discovers his whole life... \n", + "44 After awakening from a four-year coma, a forme... \n", + "45 Living a life marked by violence, neo-Nazi Der... \n", + "46 In a future British dystopian society, a shado... \n", + "47 A cyborg, identical to the one who failed to k... \n", + "48 The sole survivor of a pier shoot-out tells th... \n", + "49 Lion prince Simba and his father are targeted ... " + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      nameratingdescription
      0The Shawshank Redemption9.3Over the course of several years, two convicts...
      1The Dark Knight9.0When the menace known as the Joker wreaks havo...
      2Inception8.8A thief who steals corporate secrets through t...
      3Fight Club8.8An insomniac office worker and a devil-may-car...
      4Forrest Gump8.8The history of the United States from the 1950...
      5Pulp Fiction8.9The lives of two mob hitmen, a boxer, a gangst...
      6Interstellar8.7When Earth becomes uninhabitable in the future...
      7The Matrix8.7When a beautiful stranger leads computer hacke...
      8The Godfather9.2The aging patriarch of an organized crime dyna...
      9The Lord of the Rings: The Fellowship of the Ring8.9A meek Hobbit from the Shire and eight compani...
      10The Lord of the Rings: The Return of the King9.0Gandalf and Aragorn lead the World of Men agai...
      11The Dark Knight Rises8.4Eight years after the Joker's reign of chaos, ...
      12Se7en8.6Two detectives, a rookie and a veteran, hunt a...
      13The Lord of the Rings: The Two Towers8.8While Frodo and Sam edge closer to Mordor with...
      14Django Unchained8.5With the help of a German bounty-hunter, a fre...
      15Gladiator8.5A former Roman General sets out to exact venge...
      16Inglourious Basterds8.4In Nazi-occupied France during World War II, a...
      17The Wolf of Wall Street8.2Based on the true story of Jordan Belfort, fro...
      18Batman Begins8.2After witnessing his parents' death, Bruce lea...
      19The Silence of the Lambs8.6A young F.B.I. cadet must receive the help of ...
      20Saving Private Ryan8.6Following the Normandy Landings, a group of U....
      21Joker8.4During the 1980s, a failed stand-up comedian i...
      22The Avengers8.0Earth's mightiest heroes must come together an...
      23Shutter Island8.2Teddy Daniels and Chuck Aule, two US marshals,...
      24Star Wars: Episode IV - A New Hope8.6Luke Skywalker joins forces with a Jedi Knight...
      25Schindler's List9.0In German-occupied Poland during World War II,...
      26The Prestige8.5After a tragic accident, two stage magicians i...
      27The Departed8.5An undercover cop and a mole in the police att...
      28The Green Mile8.6A tale set on death row, where gentle giant Jo...
      29Avatar7.9A paraplegic Marine dispatched to the moon Pan...
      30Star Wars: Episode V - The Empire Strikes Back8.7After the Rebels are overpowered by the Empire...
      31The Godfather Part II9.0The early life and career of Vito Corleone in ...
      32Memento8.4A man with short-term memory loss attempts to ...
      33Back to the Future8.5Marty McFly, a 17-year-old high school student...
      34Titanic7.9A seventeen-year-old aristocrat falls in love ...
      35Guardians of the Galaxy8.0A group of intergalactic criminals must pull t...
      36Avengers: Endgame8.4After the devastating events of Avengers: Infi...
      37Goodfellas8.7The story of Henry Hill and his life in the ma...
      38Léon: The Professional8.512-year-old Mathilda is reluctantly taken in b...
      39American Beauty8.3A sexually frustrated suburban father has a mi...
      40Pirates of the Caribbean: The Curse of the Bla...8.1Blacksmith Will Turner teams up with eccentric...
      41Avengers: Infinity War8.4The Avengers and their allies must be willing ...
      42WALL·E8.4In the distant future, a small waste-collectin...
      43The Truman Show8.2An insurance salesman discovers his whole life...
      44Kill Bill: Vol. 18.2After awakening from a four-year coma, a forme...
      45American History X8.5Living a life marked by violence, neo-Nazi Der...
      46V for Vendetta8.2In a future British dystopian society, a shado...
      47Terminator 2: Judgment Day8.6A cyborg, identical to the one who failed to k...
      48The Usual Suspects8.5The sole survivor of a pier shoot-out tells th...
      49The Lion King8.5Lion prince Simba and his father are targeted ...
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "best_film_df", + "summary": "{\n \"name\": \"best_film_df\",\n \"rows\": 50,\n \"fields\": [\n {\n \"column\": \"name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 50,\n \"samples\": [\n \"The Lord of the Rings: The Two Towers\",\n \"American Beauty\",\n \"Star Wars: Episode V - The Empire Strikes Back\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"rating\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 14,\n \"samples\": [\n \"8.2\",\n \"7.9\",\n \"9.3\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"description\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 50,\n \"samples\": [\n \"While Frodo and Sam edge closer to Mordor with the help of the shifty Gollum, the divided fellowship makes a stand against Sauron's new ally, Saruman, and his hordes of Isengard.\",\n \"A sexually frustrated suburban father has a mid-life crisis after becoming infatuated with his daughter's best friend.\",\n \"After the Rebels are overpowered by the Empire, Luke Skywalker begins his Jedi training with Yoda, while his friends are pursued across the galaxy by Darth Vader and bounty hunter Boba Fett.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 22 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "11. Save the output in a file named `'best_films.csv'`:" + ], + "metadata": { + "id": "zFH9Nlo6woh-" + } + }, + { + "cell_type": "code", + "source": [ + "#write your code here\n", + "best_film_df.to_csv('best_films.csv')" + ], + "metadata": { + "id": "5JF5TlK8wr6L" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "### In-class exercise\n", + "\n", + "Find another field of information that interest you, crawl that data and add a new column for the above table." + ], + "metadata": { + "id": "1UN6VVE5wyFO" + } + }, + { + "cell_type": "code", + "source": [ + "'''\n", + "to add a new colum to a pandas, you can simply\n", + "best_film_df = pd.DataFrame({'name': film_names, 'rating': ratings, 'description': descripts,'new_column_name':new_column_list})\n", + "All other steps should be similar\n", + "'''" + ], + "metadata": { + "id": "_kET0chQwzZ-" + }, + "execution_count": null, + "outputs": [] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.13" + }, + "vscode": { + "interpreter": { + "hash": "ad2bdc8ecc057115af97d19610ffacc2b4e99fae6737bb82f5d7fb13d2f2c186" + } + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/course_materials/Topic_5_2_Scraping_Dynamic_Web_Pages_(with anwers).ipynb b/course_materials/Topic_5_2_Scraping_Dynamic_Web_Pages_(with anwers).ipynb new file mode 100644 index 0000000..e95af3a --- /dev/null +++ b/course_materials/Topic_5_2_Scraping_Dynamic_Web_Pages_(with anwers).ipynb @@ -0,0 +1,10236 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "BDxYIw85cVdw" + }, + "source": [ + " \n", + "\n", + "
      \n", + "\n", + "# Scraping Dynamic Web Pages\n", + "\n", + "\n", + "In many contexts, **the content of a webpage depends on some user interactions**, for example, google returns you contents depend on your search query, and in IMDB you can actually change the returned result by using different filters. How can we retrieve web contents in such cases? Can we automate these user actions?\n", + "\n", + "\n", + "- We are increasingly encountering pages whose contents are dynamically generated within the user's Web browser; that is, the content is determined only when the page is rendered and is updated dynamically based on user interactions and inputs.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "09w_Y_NBcVdx" + }, + "source": [ + "\n", + "\n", + "Is there a programmatic approach to drive a browser to **mimic human users' actions**, e.g., clicking on a button, filling in a form, etc., to load contents dynamically?\n", + "\n", + "\n", + "\n", + " \n", + "\n", + "\n", + "\n", + "\n", + "[Selenium](https://www.selenium.dev) is an umbrella project for a range of tools and libraries that enable and support the automation of web browsers. At its core is WebDriver, an interface to write instruction sets that can be run interchangeably in many browsers.\n", + "\n", + "\n", + "Python language bindings for selenium WebDriver is provided by the [selenium](https://pypi.org/project/selenium/) package.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "0stP5rovQlIr", + "outputId": "0557533e-5dab-40ff-95c4-eaf057c033f5" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'4.19.0'" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import selenium\n", + "selenium.__version__" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "NqAy_5MMcVdx" + }, + "source": [ + "---\n", + "\n", + "
      \n", + "\n", + "### Creating a WebDriver Instance and Navigating to the Target Page\n", + "\n", + "The `selenium.webdriver` module provides all the webdriver implementations. Currently supported WebDriver implementations are Firefox, Chrome, IE, etc (See the documentation for installation instruction)." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "id": "ZEuDvhlEQlIs" + }, + "outputs": [], + "source": [ + "from selenium import webdriver\n", + "from selenium.webdriver.chrome.service import Service\n", + "from webdriver_manager.chrome import ChromeDriverManager\n", + "\n", + "# use Chrome\n", + "s = Service(ChromeDriverManager().install())\n", + "driver = webdriver.Chrome(service=s)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "uvLNkA_rcVdx" + }, + "source": [ + "\n", + "The first thing we'll want to do with the `WebDriver` is to navigate to a page given by the URL. The convenient way to do so is to call the `.get()` method:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "id": "_IQCXgZTcVdy" + }, + "outputs": [], + "source": [ + "driver.get(\"https://www.google.com/\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9djXUp4XcVdy" + }, + "source": [ + "
      WebDriver will wait until the page has fully loaded before returning control to the script.
      " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__abstractmethods__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_authenticator_id', '_check_if_window_handle_is_current', '_file_detector', '_get_cdp_details', '_is_remote', '_mobile', '_shadowroot_cls', '_switch_to', '_unwrap_value', '_web_element_cls', '_wrap_value', 'add_cookie', 'add_credential', 'add_virtual_authenticator', 'back', 'bidi_connection', 'capabilities', 'caps', 'close', 'command_executor', 'create_web_element', 'current_url', 'current_window_handle', 'delete_all_cookies', 'delete_cookie', 'delete_downloadable_files', 'delete_network_conditions', 'download_file', 'error_handler', 'execute', 'execute_async_script', 'execute_cdp_cmd', 'execute_script', 'file_detector', 'file_detector_context', 'find_element', 'find_elements', 'forward', 'fullscreen_window', 'get', 'get_cookie', 'get_cookies', 'get_credentials', 'get_downloadable_files', 'get_issue_message', 'get_log', 'get_network_conditions', 'get_pinned_scripts', 'get_screenshot_as_base64', 'get_screenshot_as_file', 'get_screenshot_as_png', 'get_sinks', 'get_window_position', 'get_window_rect', 'get_window_size', 'implicitly_wait', 'launch_app', 'log_types', 'maximize_window', 'minimize_window', 'mobile', 'name', 'orientation', 'page_source', 'pin_script', 'pinned_scripts', 'print_page', 'quit', 'refresh', 'remove_all_credentials', 'remove_credential', 'remove_virtual_authenticator', 'save_screenshot', 'service', 'session_id', 'set_network_conditions', 'set_page_load_timeout', 'set_permissions', 'set_script_timeout', 'set_sink_to_use', 'set_user_verified', 'set_window_position', 'set_window_rect', 'set_window_size', 'start_client', 'start_desktop_mirroring', 'start_session', 'start_tab_mirroring', 'stop_casting', 'stop_client', 'switch_to', 'timeouts', 'title', 'unpin', 'virtual_authenticator_id', 'window_handles']\n" + ] + } + ], + "source": [ + "# The dir() function returns all properties and methods of the driver object\n", + "print(dir(driver))" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "id": "WuudBcUXcVdy" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'Google'" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "driver.title # retrieve the title of the page" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "eS2F0U10cVdy" + }, + "source": [ + "\n", + "### Locating Desired Tags\n", + "\n", + "Like `BeautifulSoup`, we can also acess the webpage elements using `selenium`.\n", + "\n", + "`WebDriver` offers a number of ways to find elements.\n", + "\n", + "We can use the `.find_element()` or `.find_elements()` methods to specify a locating strategy with a corresponding filter to find the first matching `WebElement` or a list of matching `WebElement`s.\n", + "\n", + "- Various locating strategies are available via the attributes of the `By` class (try `dir(By)` to see a list of supported strategies):\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "id": "YzeDuXUVQlIt" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['CLASS_NAME',\n", + " 'CSS_SELECTOR',\n", + " 'ID',\n", + " 'LINK_TEXT',\n", + " 'NAME',\n", + " 'PARTIAL_LINK_TEXT',\n", + " 'TAG_NAME',\n", + " 'XPATH',\n", + " '__class__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getstate__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__le__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " '__weakref__']" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from selenium.webdriver.common.by import By\n", + "dir(By)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "cell_style": "center", + "id": "BGa1Mx_5cVdz" + }, + "source": [ + "For example, a paragraph element of a specific class:\n", + "\n", + "```html\n", + "

      This is a paragraph of of class \"class-one\".

      \n", + "```\n", + "\n", + "can be found by using any of:\n", + "\n", + "```python\n", + "driver.find_element(By.CLASS_NAME, \"class-one\")\n", + "driver.find_element(By.CSS_SELECTOR, 'p.class-one')\n", + "driver.find_element(By.CSS_SELECTOR, \"p[class='class-one']\")\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "cell_style": "center", + "id": "n6PdxM-IcVdz" + }, + "source": [ + "A hyperlink element that contains a specific link text:\n", + "\n", + "```html\n", + "
      The 1st item\n", + "```\n", + "\n", + "can be found by using either of:\n", + "\n", + "```python\n", + "driver.find_element(By.LINK_TEXT, \"The 1st item\")\n", + "driver.find_element(By.PARTIAL_LINK_TEXT, \"1st\")\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "cell_style": "center", + "id": "1gOB79GwcVdz" + }, + "source": [ + "And a text field defined as:\n", + "\n", + "```html\n", + "\n", + "```\n", + "\n", + "can be located using either of:\n", + "\n", + "```python\n", + "driver.find_element(By.ID, \"passwd-id\")\n", + "driver.find_element(By.NAME, \"passwd\")\n", + "driver.find_element(By.CSS_SELECTOR, \"input#passwd-id\")\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PO6c_Xk7QlIu" + }, + "source": [ + "### Using Chrome's Inspect Tool to Examine a Target Element\n", + "\n", + "\n", + "Open Chrome's devtools. Use the mouse selector tool (top left button) to explore the web page content for the desired page element\n", + "\n", + "- The element will be highlighted on the page itself and its corresponding entry in the document tree.\n", + "\n", + "Take note of any identifying attributes for the target tags (class, id, etc) and use the `.find_elements()` or `.find_element()` method to fetch desired `WebElement`(s)." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "id": "0_0W1Po_cVdz", + "outputId": "7b00ca0e-7e79-447f-d15b-b175a8b4a3b8" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_box = driver.find_element(By.NAME, \"q\") # locate the input text element by its name attribute\n", + "search_box" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0ZazK33ZcVd1" + }, + "source": [ + " ### Sending Text and Keystrokes\n", + " \n", + "\n", + "We can mock keystrokes or mouth clicks with `selenium`.\n", + "\n", + "We can mock human interactions by using some methods of these `WebElement` object. For example, we can generate input by the `send_keys()` method:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "id": "lpqKN9U1cVd1" + }, + "outputs": [], + "source": [ + "search_box.clear() # clear any pre-populated text\n", + "search_box.send_keys(\"us election 2020\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "h4fJbe1acVd1" + }, + "source": [ + "
      Typing something into a text field won't automatically clear it. Instead, what we type will be appended to what's already there.
      " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "6A3zeg5qQlIv" + }, + "source": [ + " Special keys can be sent using the `Keys` class imported from `selenium.webdriver.common.keys` (try `dir(Keys)` to see a list of supported virtual keystrokes):" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "id": "j2sWvNLmcVd2" + }, + "outputs": [], + "source": [ + "from selenium.webdriver.common.keys import Keys\n", + "search_box.send_keys(Keys.RETURN)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['ADD',\n", + " 'ALT',\n", + " 'ARROW_DOWN',\n", + " 'ARROW_LEFT',\n", + " 'ARROW_RIGHT',\n", + " 'ARROW_UP',\n", + " 'BACKSPACE',\n", + " 'BACK_SPACE',\n", + " 'CANCEL',\n", + " 'CLEAR',\n", + " 'COMMAND',\n", + " 'CONTROL',\n", + " 'DECIMAL',\n", + " 'DELETE',\n", + " 'DIVIDE',\n", + " 'DOWN',\n", + " 'END',\n", + " 'ENTER',\n", + " 'EQUALS',\n", + " 'ESCAPE',\n", + " 'F1',\n", + " 'F10',\n", + " 'F11',\n", + " 'F12',\n", + " 'F2',\n", + " 'F3',\n", + " 'F4',\n", + " 'F5',\n", + " 'F6',\n", + " 'F7',\n", + " 'F8',\n", + " 'F9',\n", + " 'HELP',\n", + " 'HOME',\n", + " 'INSERT',\n", + " 'LEFT',\n", + " 'LEFT_ALT',\n", + " 'LEFT_CONTROL',\n", + " 'LEFT_SHIFT',\n", + " 'META',\n", + " 'MULTIPLY',\n", + " 'NULL',\n", + " 'NUMPAD0',\n", + " 'NUMPAD1',\n", + " 'NUMPAD2',\n", + " 'NUMPAD3',\n", + " 'NUMPAD4',\n", + " 'NUMPAD5',\n", + " 'NUMPAD6',\n", + " 'NUMPAD7',\n", + " 'NUMPAD8',\n", + " 'NUMPAD9',\n", + " 'PAGE_DOWN',\n", + " 'PAGE_UP',\n", + " 'PAUSE',\n", + " 'RETURN',\n", + " 'RIGHT',\n", + " 'SEMICOLON',\n", + " 'SEPARATOR',\n", + " 'SHIFT',\n", + " 'SPACE',\n", + " 'SUBTRACT',\n", + " 'TAB',\n", + " 'UP',\n", + " 'ZENKAKU_HANKAKU',\n", + " '__class__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getstate__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__le__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " '__weakref__']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dir(Keys)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "id": "-0VGguUQcVd2" + }, + "outputs": [], + "source": [ + "# We can also send the query text and the keystroke in one call\n", + "search_box = driver.find_element(By.NAME, \"q\") \n", + "search_box.clear() \n", + "search_box.send_keys(\"us election 2020\", Keys.RETURN) " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "VPpm3HCAQlIv" + }, + "source": [ + "### Extracting Information\n", + "\n", + "We can use a `find_elements()` method to return a list of matching `WebElement`s:\n", + "\n", + "For example, if we want to get the returned search results, we can use class name \"N54PNb\", which can be obtained by using inspection tool." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "id": "qzLfyggNcVd3", + "outputId": "e0fdf5ed-fcfc-4222-d99d-afea6fcd2a28" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ]" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_results = driver.find_elements(By.CLASS_NAME, 'N54PNb')\n", + "search_results" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Alternatively, we can use CSS selectors." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "id": "VExHjPkkcVd3", + "outputId": "8d3ad4ec-af34-4832-c4ef-d8d2ef13c9c4" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ,\n", + " ]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# a top-down approach to narrow down the selection to the correct elements \n", + "search_results = driver.find_elements(By.CSS_SELECTOR, \"div.N54PNb\")\n", + "search_results" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "7cfM-2G6cVd3" + }, + "source": [ + "The rendered text of a specific element can be retrieved by `.text`:" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_results[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "id": "XELcmo9kcVd3", + "outputId": "6ca4ff44-43da-4039-a419-37d918de21b4" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'2020 United States presidential election\\nWikipedia\\nhttps://en.wikipedia.org › wiki › 2020_United_States_p...\\nThe 2020 United States presidential election was the 59th quadrennial presidential election, held on Tuesday, November 3, 2020. The Democratic ticket of ...'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_results[0].text" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "7ePjorypcVd3" + }, + "source": [ + "The parent `WebElement` can also be chained with a `find_element()` method to access child elements:" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "id": "i0TbKkAOcVd4", + "outputId": "6c3f0247-fd99-4212-b3d1-95dbce10ac1c" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'2020 United States presidential election\\nWikipedia\\nhttps://en.wikipedia.org › wiki › 2020_United_States_p...'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_results[0].find_element(By.CLASS_NAME, \"yuRUbf\").text" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "id": "p9xvP0jLcVd4", + "outputId": "cbbee91b-c905-4442-888e-cf2dabf199c7" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'2020 United States presidential election'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_results[0].find_element(By.CLASS_NAME, \"LC20lb\").text" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9sv2y4mJcVd4" + }, + "source": [ + "---\n", + "\n", + "## Transitioning to Beautiful Soup\n", + "\n", + "\n", + "\n", + "In many cases, we may want to use selenium for mocking interactions and use Beautiful Soup to process HTML codes. We can combine these two tools together.\n", + "\n", + "\n", + "1. After retrieving the search result page, we instruct selenium to hand off the page source to Beautiful Soup:\n", + "\n", + "The HTML codes can be obtained by using `driver.page_source`" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "id": "tPbAmIUdcVd4" + }, + "outputs": [], + "source": [ + "from bs4 import BeautifulSoup\n", + "\n", + "search_result_soup = BeautifulSoup(driver.page_source, 'html.parser')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Eiape7XYcVd4" + }, + "outputs": [], + "source": [ + " print(search_result_soup.prettify()) " + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "id": "b3f4gEZccVd5" + }, + "outputs": [], + "source": [ + "search_result_list = search_result_soup.find_all('div', {'class':'N54PNb'})" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "
      The 2020 United States presidential election was the 59th quadrennial presidential election, held on Tuesday, November 3, 2020. The Democratic ticket of ...
      " + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_list[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "id": "0jenW3QKcVd5", + "outputId": "680c14b4-0a57-46eb-9b3e-f62952db2942" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + "
      \n", + "

      \n", + " 2020 United States presidential election\n", + "

      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + " \"\"\n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " Wikipedia\n", + " \n", + "
      \n", + "
      \n", + " \n", + " https://en.wikipedia.org\n", + " \n", + " › wiki › 2020_United_States_p...\n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " Wikipedia\n", + " \n", + "
      \n", + "
      \n", + " \n", + " https://en.wikipedia.org\n", + " \n", + " › wiki › 2020_United_States_p...\n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " The\n", + " \n", + " 2020 United States presidential election\n", + " \n", + " was the 59th quadrennial\n", + " \n", + " presidential election\n", + " \n", + " , held on Tuesday, November 3,\n", + " \n", + " 2020\n", + " \n", + " . The Democratic ticket of ...\n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "\n" + ] + } + ], + "source": [ + "print(search_result_list[0].prettify())" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "id": "RVKFAUfVcVd5", + "outputId": "7d3d00eb-f444-4506-a9ff-9d4824b459fc" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://en.wikipedia.org/wiki/2020_United_States_presidential_election'" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_list[0].find(\"a\").get('href')" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "id": "SGw50luAcVd5", + "outputId": "369028bf-1407-4de3-afc0-7302ebd2075a", + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[
      ,\n", + "

      2020 United States presidential election

      ,\n", + "
      \"\"
      Wikipedia
      https://en.wikipedia.org › wiki › 2020_United_States_p...
      ,\n", + " ]" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_list[0].find(\"a\").contents" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "id": "ho-7LC21cVd5", + "outputId": "8566af59-217c-462b-e7b0-c3e5b1959fe4" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'2020 United States presidential election'" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_list[0].find(\"a\").contents[1].get_text()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'2020 United States presidential election'" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_list[0].find(\"h3\").get_text()" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "id": "5vVyd8l-cVd6", + "outputId": "072b3486-1fb1-46af-8221-d1910bf06738" + }, + "outputs": [ + { + "data": { + "text/html": [ + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      texturl
      02020 United States presidential electionhttps://en.wikipedia.org/wiki/2020_United_Stat...
      12020 United States electionshttps://en.wikipedia.org/wiki/2020_United_Stat...
      2Presidential Election Results and Electoral Ma...https://edition.cnn.com/election/2020/results/...
      3Behind Biden's 2020 Victoryhttps://www.pewresearch.org/politics/2021/06/3...
      4Presidential Election Results: Biden Winshttps://www.nytimes.com/interactive/2020/11/03...
      5Presidential Election of 2020https://www.270towin.com/2020_Election/
      6United States presidential election of 2020https://www.britannica.com/event/United-States...
      7US Election 2020 Resultshttps://www.bbc.com/news/election/us2020/results
      8Presidential election, 2020https://ballotpedia.org/Presidential_election,...
      92020 Presidential Election: News, Polls, Resul...https://www.nbcnews.com/politics/2020-election
      \n", + "
      " + ], + "text/plain": [ + " text \\\n", + "0 2020 United States presidential election \n", + "1 2020 United States elections \n", + "2 Presidential Election Results and Electoral Ma... \n", + "3 Behind Biden's 2020 Victory \n", + "4 Presidential Election Results: Biden Wins \n", + "5 Presidential Election of 2020 \n", + "6 United States presidential election of 2020 \n", + "7 US Election 2020 Results \n", + "8 Presidential election, 2020 \n", + "9 2020 Presidential Election: News, Polls, Resul... \n", + "\n", + " url \n", + "0 https://en.wikipedia.org/wiki/2020_United_Stat... \n", + "1 https://en.wikipedia.org/wiki/2020_United_Stat... \n", + "2 https://edition.cnn.com/election/2020/results/... \n", + "3 https://www.pewresearch.org/politics/2021/06/3... \n", + "4 https://www.nytimes.com/interactive/2020/11/03... \n", + "5 https://www.270towin.com/2020_Election/ \n", + "6 https://www.britannica.com/event/United-States... \n", + "7 https://www.bbc.com/news/election/us2020/results \n", + "8 https://ballotpedia.org/Presidential_election,... \n", + "9 https://www.nbcnews.com/politics/2020-election " + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "url_list = []\n", + "text_list = []\n", + "\n", + "for search_result in search_result_list:\n", + " # write your code here\n", + " url_list.append(search_result.find(\"a\").get('href'))\n", + " text_list.append(search_result.find(\"a\").contents[1].get_text())\n", + " \n", + "search_result_df = pd.DataFrame({'text': text_list, 'url': url_list}) \n", + "search_result_df" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IecY4wl0cVd6" + }, + "source": [ + "2. After using Beautiful Soup to process the HTML code, we can continue using selenium to pretend navigating other webpages, for example, getting additional search results.\n", + "\n", + "Navigating around the search result is just a repeated application of generating keystrokes with `selenium`:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can use `Keys.END` to scroll down to the end of the html page." + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "id": "_B1eFgnYcVd6" + }, + "outputs": [], + "source": [ + "driver.find_element(By.TAG_NAME, 'body').send_keys(Keys.END)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "# keep scrolling down until no new content is loaded\n", + "import time\n", + "body = driver.find_element(By.TAG_NAME, 'body')\n", + "while True:\n", + " s1 = driver.page_source\n", + " body.send_keys(Keys.END)\n", + " time.sleep(2)\n", + " s2 = driver.page_source\n", + " if s1==s2:\n", + " break" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can click on an element using the `click()` method. Try to find \"T7sFge\" using Chrome's inspection tool. " + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "id": "18ANOAw4cVd6" + }, + "outputs": [], + "source": [ + "driver.find_element(By.CLASS_NAME, \"T7sFge\").click() " + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      texturl
      02020 United States presidential electionhttps://en.wikipedia.org/wiki/2020_United_Stat...
      12020 United States electionshttps://en.wikipedia.org/wiki/2020_United_Stat...
      2Presidential Election Results and Electoral Ma...https://edition.cnn.com/election/2020/results/...
      3Behind Biden's 2020 Victoryhttps://www.pewresearch.org/politics/2021/06/3...
      4Presidential Election Results: Biden Winshttps://www.nytimes.com/interactive/2020/11/03...
      .........
      89Pre-election polls in 2020 had the largest err...https://news.vanderbilt.edu/2021/07/19/pre-ele...
      90Key December Dates for the Electoral Collegehttps://bipartisanpolicy.org/blog/december-ele...
      91Research note: Examining false beliefs about v...https://misinforeview.hks.harvard.edu/article/...
      92How the president is elected | USAGovhttps://www.usa.gov/election
      93A belief systems analysis of fraud beliefs fol...https://www.nature.com/articles/s41562-023-015...
      \n", + "

      94 rows × 2 columns

      \n", + "
      " + ], + "text/plain": [ + " text \\\n", + "0 2020 United States presidential election \n", + "1 2020 United States elections \n", + "2 Presidential Election Results and Electoral Ma... \n", + "3 Behind Biden's 2020 Victory \n", + "4 Presidential Election Results: Biden Wins \n", + ".. ... \n", + "89 Pre-election polls in 2020 had the largest err... \n", + "90 Key December Dates for the Electoral College \n", + "91 Research note: Examining false beliefs about v... \n", + "92 How the president is elected | USAGov \n", + "93 A belief systems analysis of fraud beliefs fol... \n", + "\n", + " url \n", + "0 https://en.wikipedia.org/wiki/2020_United_Stat... \n", + "1 https://en.wikipedia.org/wiki/2020_United_Stat... \n", + "2 https://edition.cnn.com/election/2020/results/... \n", + "3 https://www.pewresearch.org/politics/2021/06/3... \n", + "4 https://www.nytimes.com/interactive/2020/11/03... \n", + ".. ... \n", + "89 https://news.vanderbilt.edu/2021/07/19/pre-ele... \n", + "90 https://bipartisanpolicy.org/blog/december-ele... \n", + "91 https://misinforeview.hks.harvard.edu/article/... \n", + "92 https://www.usa.gov/election \n", + "93 https://www.nature.com/articles/s41562-023-015... \n", + "\n", + "[94 rows x 2 columns]" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_result_soup = BeautifulSoup(driver.page_source, 'html.parser')\n", + "search_result_list = search_result_soup.find_all('div', {'class':'N54PNb'})\n", + "\n", + "import pandas as pd\n", + "\n", + "url_list = []\n", + "text_list = []\n", + "\n", + "for search_result in search_result_list:\n", + " # write your code here\n", + " url_list.append(search_result.find(\"a\").get('href'))\n", + " text_list.append(search_result.find(\"a\").contents[1].get_text())\n", + "search_result_df = pd.DataFrame({'text': text_list, 'url': url_list}) \n", + "search_result_df" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "nbU-WCQmcVd6" + }, + "source": [ + "`WebDriver`'s `back()` and `forward()` methods allow us to move backward and forward in the browser's history:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "id": "6BTTFZ2scVd7" + }, + "outputs": [], + "source": [ + "driver.back() # driver.driver.forward()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "rg8XnGAzcVd7" + }, + "source": [ + "`.refresh()` refreshes the current page:" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "id": "taI8xTy7cVd7" + }, + "outputs": [], + "source": [ + "driver.refresh()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2jF2yHzScVd7" + }, + "source": [ + "When we are finished with the browser session, we should close the browser window:" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "id": "qMBCJBHocVd7" + }, + "outputs": [], + "source": [ + "driver.quit() " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "imOpFporcVd7" + }, + "source": [ + "
      We can also call quit() method instead of close(). quit() will exit entire browser whereas close() will close one tab.
      " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Exercise:* Combine the usage of Beautiful Soup and Selenium to get the returned result by using `Python` as the search query (try to get at least 2 pages of search results)." + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [], + "source": [ + "# write your codes here" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "THPynZo5QlIx" + }, + "source": [ + "---\n", + "\n", + "\n", + "## Waits\n", + "\n", + "\n", + "Nowadays, it is increasingly the case that, when a page is loaded, the elements which we want to interact with may load at different time intervals (e.g., some elements may be added after the document has completed loading). This makes locating elements difficult.\n", + "\n", + "Selenium's `WebDriverWait` addresses this issue by providing some slack between actions performed by the browser and those instructed by our WebDriver script. In particular, we can use waits to tell the WebDriver to:\n", + "\n", + "- Wait a certain amount of time before throwing an exception, e.g., `driver.implicitly_wait(time_in_seconds)`;\n", + " \n", + " - It needs to be called only once per selenium session.\n", + " - It makes each command wait for the defined time before resuming execution \n", + " \n", + " ```python\n", + " # setting an implicit wait of 10 seconds \n", + "driver.implicitly_wait(10)\n", + " ```" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "O3LAP1rEcVd4" + }, + "source": [ + "\n", + "\n", + "- Wait for certain conditions before proceeding further, e.g., `WebDriverWait(driver).until(some_condition)`.\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "id": "U73lu-6hQlIy" + }, + "outputs": [], + "source": [ + "from selenium import webdriver\n", + "from selenium.webdriver.chrome.service import Service\n", + "from webdriver_manager.chrome import ChromeDriverManager\n", + "from selenium.webdriver.common.by import By\n", + "\n", + "# use Chrome\n", + "s = Service(ChromeDriverManager().install())\n", + "driver = webdriver.Chrome(service=s)\n", + "\n", + "from selenium.webdriver.support.ui import WebDriverWait\n", + "driver.get(\"https://techcrunch.com/video/\")\n", + "\n", + "# wait up to 10 seconds before throwing a TimeoutException unless it finds the element within 10 seconds\n", + "loadmore_button = WebDriverWait(driver, 10).until(lambda d: d.find_element(By.CSS_SELECTOR, \"button.load-more\"))\n", + "loadmore_button.click()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "3jlBbgmjFSVy" + }, + "source": [ + " \n", + "There are predefined conditions for [frequent wait operations](https://www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.expected_conditions.html). Some of them are:\n", + "\n", + " - `title_is()`\n", + " - `title_contains()`\n", + " - `presence_of_element_located()`\n", + " - `visibility_of_element_located()`\n", + " - `visibility_of()`\n", + " - `presence_of_all_elements_located()`\n", + " - `element_to_be_clickable()`\n", + " - `element_located_to_be_selected()`\n", + " - `element_selection_state_to_be()`\n", + " - `element_located_selection_state_to_be()`\n", + " - `alert_is_present()`\n", + " - ...\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "from selenium.webdriver.common.by import By\n", + "from selenium.webdriver.support import expected_conditions as EC\n", + "#from selenium.webdriver.support.ui import WebDriverWait\n", + "\n", + "#driver.get(\"https://techcrunch.com/video/\")\n", + "# EC.element_to_be_clickable is a class\n", + "\n", + "WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, \"button.load-more\"))).click() " + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n", + "3\n", + "2\n", + "1\n", + "0\n" + ] + } + ], + "source": [ + "remaining_pages = 5\n", + "\n", + "while remaining_pages > 0:\n", + " \n", + " try:\n", + " WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, \"button.load-more\"))).click() \n", + " remaining_pages -= 1\n", + " print(remaining_pages)\n", + " except:\n", + " break " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qrDn3MIEcoDB" + }, + "source": [ + "Please refer to this Web page for [the detail](https://www.selenium.dev/documentation/webdriver/waits) of uses of waits.\n", + "\n", + "***Warning: Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times.***" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "from bs4 import BeautifulSoup\n", + "\n", + "video_soup = BeautifulSoup(driver.page_source, 'html.parser')" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " Videos | TechCrunch\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " Open Navigation\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " Videos\n", + "

      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Putting\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Putting Robots to Work\n", + " \n", + "

      \n", + "
      \n", + " We’ve seen the demos and the viral videos, but moving from research to real world is its own comp...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Shaping\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Shaping Robots, Environments, and People for Harmony\n", + " \n", + "

      \n", + "
      \n", + " As robots and AI begin to pervade everyday life, we must take lessons from industry and academic ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"From\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " From Cage to Stage: Commercializing AI and Robotics\n", + " \n", + "

      \n", + "
      \n", + " What does it take to bring a robot or AI process from the lab to market? Learn from experience wi...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Education\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Education FIRST\n", + " \n", + "

      \n", + "
      \n", + " From the Segway to iBot to AutoSyringe, Dean Kamen has made a name as one of the biggest inventor...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"TechCrunch\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " TechCrunch Robotics Pitch-off\n", + " \n", + "

      \n", + "
      \n", + " The industry’s brightest entrepreneurs will take the stage in front of a live audience and a pane...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Pre-seed\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Pre-seed to Unicorn: Lessons from HAX Robotics Founders\n", + " \n", + "

      \n", + "
      \n", + " SOSV’s HAX, the hands on early stage investor in hard tech, has been making big bets on robotics ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"UC\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " UC Berkeley AI Research Lab Demo\n", + " \n", + "

      \n", + "
      \n", + " UC Berkeley’s Artificial Intelligence Research Lab showcases the latest breakthroughs in robotic ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Automating\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Automating Amazon\n", + " \n", + "

      \n", + "
      \n", + " Amazon’s huge bet on robotics dates back to its 2012 acquisition of Kiva Systems. Over the past d...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"The\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " The Fulfilling World of Warehouse Robotics\n", + " \n", + "

      \n", + "
      \n", + " Logistics and fulfillment may well be the hottest category in robotics at the moment. Locus Robot...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Agility\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Agility Digit Demo\n", + " \n", + "

      \n", + "
      \n", + " Agility Robotics cofounders Damion Shelton and Jonathan Hurst will showcase their bipedal fulfill...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Lab\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Lab Work\n", + " \n", + "

      \n", + "
      \n", + " If you’re looking for the bleeding edge of robotics and AI research, you’ve come to the right pla...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Funding\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Funding the Future\n", + " \n", + "

      \n", + "
      \n", + " As funding has dried up for many startups, robotics have weathered the storm quite well. The pand...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"The\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " The Changing Face of Work\n", + " \n", + "

      \n", + "
      \n", + " Robotics are set to profoundly impact the future of how America works. Automation is an inevitabi...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"The\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " The Grid Needs Willpower with Secretary Jennifer Granholm\n", + " \n", + "

      \n", + "
      \n", + " To ditch fossil fuels and slash emissions, we’ll need political will. U.S. Energy Secretary Jenni...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Startup\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Startup Pitch Practice at TC Sessions: Climate 2022\n", + " \n", + "

      \n", + "
      \n", + " Join us to see three companies pitching at TC Sessions Climate. Hailing from around the United St...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"How\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " How Corporations Can Be Better Citizens\n", + " \n", + "

      \n", + "
      \n", + " As corporations become more and more powerful, Corporate Social Responsibility (CSR) encompasses ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Startup\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Startup Pitch Feedback Session 2 at TC Sessions: Climate 2022\n", + " \n", + "

      \n", + "
      \n", + " All exhibiting startups at TC Sessions: Climate are invited to present a fast pitch and hear feed...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"TechCrunch\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " TechCrunch Climate Desk Analysis 2022\n", + " \n", + "

      \n", + "
      \n", + " Hang with us at the TC Climate Desk to catch up on what you may have missed from across the show ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Startup\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Startup Pitch Feedback Session 1 at TC Sessions: Climate 2022\n", + " \n", + "

      \n", + "
      \n", + " All exhibiting startups at TC Sessions: Climate are invited to present a fast pitch and hear feed...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Extreme\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Extreme Tech Challenge 2022 Global Finals: Pitch Session #2 & Winner Announcement\n", + " \n", + "

      \n", + "
      \n", + " Extreme Tech Challenge (XTC) Category and Special Award Winners to pitch their innovative startup...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Wowwee\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Wowwee Paper Jamz Guitar Demonstration\n", + " \n", + "

      \n", + "
      \n", + " A hands on demonstration of the Wowwee Paper Jamz Guitar.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Viliv\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Viliv S10 Blade Tablet Demonstration\n", + " \n", + "

      \n", + "
      \n", + " John Biggs demonstrates the Viliv S10 Blade tablet.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"HTC\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " HTC EVO 4G Demonstration\n", + " \n", + "

      \n", + "
      \n", + " John Biggs demonstrates Sprint's HTC EVO 4G smartphone.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Backstage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Backstage Interview with CakeHealth\n", + " \n", + "

      \n", + "
      \n", + " Watch what CakeHealth had to say about their experience at the Startup Battlefield in this backst...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Demonstration\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Demonstration of WiFi Sync for iPhone\n", + " \n", + "

      \n", + "
      \n", + " John Biggs provides a hands on demonstration of the WiFi Sync for iPhone.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"T-Mobile\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " T-Mobile HTC HD2 Unboxing\n", + " \n", + "

      \n", + "
      \n", + " Watch John Biggs unpack the T-Mobile HTC HD2.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"People\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " People Who Don't Have Smartphones\n", + " \n", + "

      \n", + "
      \n", + " Take a look at people who don't have smartphones.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Hands-On\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Hands-On Ulysse Nardin Chairman Demonstration\n", + " \n", + "

      \n", + "
      \n", + " A hands-on demonstration of the Ulysse Nardin Chairman.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"InColor\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " InColor Story Book Demonstration\n", + " \n", + "

      \n", + "
      \n", + " A demonstration of the InColor StoryBook electronic coloring book.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Backstage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Backstage Interview with Tonara\n", + " \n", + "

      \n", + "
      \n", + " Tonara talks about their experience on the Startup Battlefield at Disrupt San Fransisco 2011....\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Backstage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Backstage Interview with Quest.Li\n", + " \n", + "

      \n", + "
      \n", + " The founder of Quest.Li talks about his experience on the Startup Battlefield at Disrupt San Fran...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Backstage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Backstage Interview with Shaker\n", + " \n", + "

      \n", + "
      \n", + " Shaker's guys talk about their experience on the Startup Battlefield at Disrupt San Fransisco...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Groupon\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Groupon Founder Andrew Mason Unveils Grouspawn Dating Assistant\n", + " \n", + "

      \n", + "
      \n", + " Groupon's founder Andrew Mason reveals the daily deal site's latest initiative.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Backstage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Backstage Interview with Amen\n", + " \n", + "

      \n", + "
      \n", + " Watch this bacstage interview with Amen founders at the Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"GameCrush\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " GameCrush Startup Battlefield Finalist Demo\n", + " \n", + "

      \n", + "
      \n", + " The founders of Game Crush deliver their presentation in the final round of Disrupt.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Kapoosh\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Kapoosh Knife Holder Demonstration\n", + " \n", + "

      \n", + "
      \n", + " A demonstration of the Kapoosh knife holder.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Motorola\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Motorola Devour Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs demonstrates Verizon's Motorola Devour.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Kempler\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Kempler and Strauss Watch Phone Demonstration\n", + " \n", + "

      \n", + "
      \n", + " John Biggs demonstrates the Kempler and Strauss watch phone.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Qwiki\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Qwiki Wins the Disrupt Cup\n", + " \n", + "

      \n", + "
      \n", + " Qwiki celebrates after winning the grand prize.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Panasonic\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Panasonic DMC-G10 Camera Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs presents the Panasonic DMC-G10 4/3s Camera.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Vinod\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Vinod Khosla on the Potential of Green Technology\n", + " \n", + "

      \n", + "
      \n", + " The green tech investor talks to reporter Evelyn Rusli about forecasting, high potential green te...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"An\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " An Interview with Qwiki After Their Disrupt Victory\n", + " \n", + "

      \n", + "
      \n", + " The founders of Qwiki talk to co-editor, Erick Schonfeld.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Review\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Review of Truphone App on the iPad\n", + " \n", + "

      \n", + "
      \n", + " John Biggs presents the Truphone application for iPad.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"A\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " A Quick Look at America Test Kitchen App for DSi\n", + " \n", + "

      \n", + "
      \n", + " John Biggs provides a quick look at America's Test Kitchen application for the Nintendo DSi.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Qwiki\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Qwiki Wins TechCrunch Disrupt\n", + " \n", + "

      \n", + "
      \n", + " Erick Schonfeld interviews Qwiki team after they won the TechCrunch Disrupt Cup.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CloudFlare\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CloudFlare Startup Battlefield Finalist Presentation\n", + " \n", + "

      \n", + "
      \n", + " The founders of CloudFlare deliver their presentation in the final round of Disrupt.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CrunchGear\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CrunchGear Demos Pandora Controlled by Ford Sync\n", + " \n", + "

      \n", + "
      \n", + " CrunchGear demonstrates Pandora application controlled by Ford Sync.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"TechCrunch\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " TechCrunch Disrupt's Women in Tech Panel\n", + " \n", + "

      \n", + "
      \n", + " Lauren Leto of Bnter, Leila Chirayath Janah of Samasource, Sara Chipps of Girl Developer IT, Cyan...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Datashift\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Datashift Startup Battlefield Finalist Presentation\n", + " \n", + "

      \n", + "
      \n", + " The founders of Datashift deliver their presentation in the final round of Disrupt.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Opzi\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Opzi Startup Battlefield Finalist Presentation\n", + " \n", + "

      \n", + "
      \n", + " The founders of Opzi deliver their presentation in the final round.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CrunchGear\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CrunchGear Demos Fisher Price's Bigfoot\n", + " \n", + "

      \n", + "
      \n", + " CrunchGear demonstrates Fisher Price's Bigfoot toy.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CrunchGear\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CrunchGear Demos Xbox 360 Kinect and Dance Central\n", + " \n", + "

      \n", + "
      \n", + " CrunchGear demonstrates Xbox 360 Kinect and Dance Central\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Disrupt\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Disrupt Cup Winner Qwiki's Presentation\n", + " \n", + "

      \n", + "
      \n", + " The founders of Qwiki deliver their presentation in the final round of Disrupt.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"The\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " The Mobile Frontiers of Payments and Trading\n", + " \n", + "

      \n", + "
      \n", + " Watch this New Mobile Frontiers panel with Laura Chambers (PayPal), Holger Luedorf (Foursquare) a...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"World\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " World of Warcraft Headset Demonstration\n", + " \n", + "

      \n", + "
      \n", + " John Biggs demonstrates the World of Warcraft Headset.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"WiseDame\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " WiseDame Hackathon Presentation\n", + " \n", + "

      \n", + "
      \n", + " J'aime Ohm shows off her Hackathon award winning hack at Disrupt.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Shwowp\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Shwowp Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Shwowp's Disrupt Demo, with commentary by Don Dodge, John Ham, and Loic Le Meur and Sukhinder...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Seth\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Seth Goldstein and Billy Chasen on Turntable.Fm\n", + " \n", + "

      \n", + "
      \n", + " John Biggs interviews Seth Goldstein and Billy Chasen about Turntable.fm at Disrupt San Fransisco...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CrunchGear\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CrunchGear Holiday Gift Guide Intro\n", + " \n", + "

      \n", + "
      \n", + " Devin Coldewey's intro for the CrunchGear holiday gift guide.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"SGN&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " SGN's Shervin Pishevar Unveils the Mini Tycoon IPhone Social Game\n", + " \n", + "

      \n", + "
      \n", + " SGN founder Shervin Pishevar unveils Mini Tycoon.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Microsoft\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Microsoft Kinect for Xbox 360 Review\n", + " \n", + "

      \n", + "
      \n", + " Greg Kumparak of CrunchGear reviews Microsoft's new Kinect for the Xbox 360\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Vinod\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Vinod Khosla on Innovation in Tech and Energy\n", + " \n", + "

      \n", + "
      \n", + " Join a fireside chat with Khosla Ventures' founder Vinod Khosla on innovation in Tech and Ene...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Tom\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Tom Ball, Joe Kraus, James Slavet on Venture Capital\n", + " \n", + "

      \n", + "
      \n", + " Tom Ball, Joe Kraus, James Slavet and others talk about venture capital for startups at Disrupt S...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Leica\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Leica V-Lux 20 Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs reviews the Leica V-Lux 20 camera.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"CrunchGear\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " CrunchGear Sing-A-Ma-Jigs Demonstration\n", + " \n", + "

      \n", + "
      \n", + " CrunchGear demonstrates Fisher-Price's Sing-A-Ma-Jigs singing stuffed toys.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Twitter\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Twitter Analytics Tool Announcement\n", + " \n", + "

      \n", + "
      \n", + " April Underwood and Chris Colder announce the new product from Twitter at Disrupt San Fransisco 2...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Shervin\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Shervin Pishevar on the Jedi Council of VC\n", + " \n", + "

      \n", + "
      \n", + " Join the Disrupt Backstage interview with Shervin Pishevar and Alexia Tsotsis at Disrupt San Fran...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Wicked\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Wicked Lasers Torch Flashlight Review\n", + " \n", + "

      \n", + "
      \n", + " Scott Merrill from CrunchGear reviews Wicked Lasers' Torch Flashlight.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Plex/Nine\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Plex/Nine and Plex App for iOS Review\n", + " \n", + "

      \n", + "
      \n", + " An exclusive review of Plex/Nine and Plex App for iOS.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Jeremy\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Jeremy Stoppelman on Yelp and Email Deal Products\n", + " \n", + "

      \n", + "
      \n", + " Jeremy Stoppelman talks about his Email Deals group buying products Yelp.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"enTourage\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " enTourage eDGe Dualbook Review\n", + " \n", + "

      \n", + "
      \n", + " Scott Merrill from CrunchGear reviews the enTourage eDGe dualbook.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Exploring\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Exploring Apple's Tablet Gestures\n", + " \n", + "

      \n", + "
      \n", + " Learn the finger gestures used to activate Apple's Tablets.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Kevin\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Kevin Rose on Managing Digg and Starting Milk\n", + " \n", + "

      \n", + "
      \n", + " Michael Arrington interviews Kevin Rose at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"A\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " A Review of EyeconTroller for iPhone and iPod Touch\n", + " \n", + "

      \n", + "
      \n", + " Crunchgear's review of EyeconTroller for iPhone and iPod Touch.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Prism\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Prism Skylabs Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch the Prism Skylabs presentation for the Startup Battlefield at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Postmates\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Postmates Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch Postmates' pitch for the Startup Battlefield at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Eye-Fi\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Eye-Fi X2 Pro SDHC Card Review\n", + " \n", + "

      \n", + "
      \n", + " Scott Merrill from CrunchGear reviews the Eye-Fi X2 Pro SDHC card.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Grow\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Grow the Planet Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch Grow the Planet's pitch for the Startup Battlefield at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Final\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Final Verdict on Windows Phone 7\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch reporters deliver their opinion on whether the latest Microsoft mobile operating syste...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Fantasma\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Fantasma Remote Control Spider Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs reviews the Fantasma Remote Control Spider.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Drew\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Drew Houston on the Beginning of Dropbox\n", + " \n", + "

      \n", + "
      \n", + " Drew Houston, Co-Founder and CEO of Dropbox speaks to Erick Schonfeld about the company's beg...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steve\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steve Anderson on Signaling Risk\n", + " \n", + "

      \n", + "
      \n", + " Steve Anderson, founder of Baseline Ventures, talks to Chris Dixon about VCs and Seed Funding.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steve\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steve Anderson on Funding and Market Health\n", + " \n", + "

      \n", + "
      \n", + " Steve Anderson, founder of Baseline Ventures, talks to Chris Dixon about the venture market.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steve\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steve Chen and Sarah Lacy at Disrupt Beijing 2011\n", + " \n", + "

      \n", + "
      \n", + " Watch Steve Chen talk to Sarah Lacy at Disrupt Beijing 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steve\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steve Anderson on Founding Baseline Ventures\n", + " \n", + "

      \n", + "
      \n", + " Steve Anderson explains why he launched Baseline Ventures.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steve\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steve Anderson on Investing in Heroku\n", + " \n", + "

      \n", + "
      \n", + " Steve Anderson, founder of Baseline Ventures, talks to Chris Dixon about betting on Heroku.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"An\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " An Interview with Yossi Vardi\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Israeli investor Yossi Vardi explains why he goes to 163 events each yea...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Yossi\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Yossi Vardi on Green Energy\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Israeli investor Yossi explains how did he get into green energy and how...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Yossi\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Yossi Vardi on Exploiting Child Labor\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Israeli investor Yossi Vardi discusses why he likes to exploit child lab...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Yossi\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Yossi Vardi on the Cloud\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Israeli investor Yossi Vardi talks about the Cloud.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Kevin\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Kevin Ryan Full Interview\n", + " \n", + "

      \n", + "
      \n", + " Chris Dixon interviews Gilt Groupe CEO and founder, Kevin Ryan.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Meebo\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Meebo CEO Answers Rapid Fire Questions\n", + " \n", + "

      \n", + "
      \n", + " Meebo CEO Seth Sternberg answers rapid fire questions.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Ryan\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Ryan on the Early Days of DoubleClick\n", + " \n", + "

      \n", + "
      \n", + " Gilt Groupe CEO and founder Kevin Ryan reflects on the early days of DoubleClick.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Gilt\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Gilt CEO Kevin Ryan on The Bubble\n", + " \n", + "

      \n", + "
      \n", + " Ryan and Dixon offer insights on \"The Bubble\".\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Andy\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Andy Kessler on Technological Innovation\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andy Kessler and Andrew Keen discuss productivity and technological inno...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Andy\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Andy Kessler on the FCC\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andy Kessler explains why the FCC should be shut down.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Andy\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Andy Kessler on the World Economy\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andy Kessler on why the global economy is still in the dumper and how te...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Andy\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Andy Kessler on Where to Invest\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andy Kessler advises investment in entrepreneurs who eat people, especia...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Evgeny Morozov\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Stanford visiting fellow Evgeny Morozov discusses the U.S. government\u0003...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"An\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " An Interview with Evgeny Morozov\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Stanford visiting fellow Evgeny Morozov discusses the right foreign poli...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"FlatFrog\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " FlatFrog Multitouch 4000 Alpha Demo\n", + " \n", + "

      \n", + "
      \n", + " A demonstration of FlatFrog Multitouch 4000 Alpha.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Google\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Google Reader Play on a Viliv X70\n", + " \n", + "

      \n", + "
      \n", + " A review of Google Reader Play on a Viliv X70.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Jolibook\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Jolibook Netbook Review\n", + " \n", + "

      \n", + "
      \n", + " Robin Wauters reviews Jolicloud's Jolibook netbook.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"GM&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " GM's Enhanced Vision System HUD Review\n", + " \n", + "

      \n", + "
      \n", + " Learn about GM's Enhanced Vision System HUD.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Vocre\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Vocre Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch Vocre's presentation for the Startup Battlefield at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Remind101&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Remind101's Brad Kopf on the Imagine K12 Program\n", + " \n", + "

      \n", + "
      \n", + " Alexia Tsotsis talks to Remind101 founder Brad Kopf about Imagine K12 program where education sta...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"GoInstant\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " GoInstant Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch the GoInstant presentation for the Startup Battlefield at Disrupt San Fransisco 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Sony\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Sony X Series Netbook Review\n", + " \n", + "

      \n", + "
      \n", + " A review of Sony's X Series netbook.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Gunnar\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Gunnar Optik's 3D Glasses Review\n", + " \n", + "

      \n", + "
      \n", + " Scott Merrill reviews Gunnar Optik's 3D glasses\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"HandStand\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " HandStand iPad Case Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs reviews the HandStand iPad case.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Lenovo&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Lenovo's U1 Hybrid Netbooktablet Review\n", + " \n", + "

      \n", + "
      \n", + " Watch Lenovo's U1 Hybrid Netbooktablet demonstrated at CES 2010.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Hasbro\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Hasbro My3D Adapter Review\n", + " \n", + "

      \n", + "
      \n", + " John Biggs reviews the Hasbro My3D Adapter\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Livestream&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Livestream's Max Haot on the Early Days\n", + " \n", + "

      \n", + "
      \n", + " Livestream co-founder Max Haot talks about the company's early days.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Lumier\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Lumier Startup Battlefield Presentation\n", + " \n", + "

      \n", + "
      \n", + " Watch Lumier pitch their on the Startup Battlefield at Disrupt New York City 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Livestream&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Livestream's Max Haot on Fending Off Digital Piracy\n", + " \n", + "

      \n", + "
      \n", + " Livestream co-founder Max Haot talks about fending off digital piracy.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Dropbox\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Dropbox Service Success and Growth\n", + " \n", + "

      \n", + "
      \n", + " Erick Schonfeld talks to Drew Houston, Co-Founder and CEO of Dropbox. Drew talks about the consum...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Dropbox\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Dropbox Drew Houston Looking Ahead\n", + " \n", + "

      \n", + "
      \n", + " Erick Schonfeld talks to Drew Houston, Co-Founder and CEO of Dropbox.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Drew\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Drew Houston on Taking Advice from Paul Graham\n", + " \n", + "

      \n", + "
      \n", + " Drew Houston, Co-Founder and CEO of Dropbox speaks to Erick Schonfeld about getting advice from P...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Drew\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Drew Houston on Being Open About a Startup Idea\n", + " \n", + "

      \n", + "
      \n", + " Erick Schonfeld talks to Drew Houston, Co-Founder and CEO of Dropbox, discussing being open about...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Drew\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Drew Houston on Early Testing\n", + " \n", + "

      \n", + "
      \n", + " Drew Houston, Co-Founder and CEO of Dropbox speaks to Erick Schonfeld about early testing.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Kevin\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Kevin Ryan on the Importance of Presentation\n", + " \n", + "

      \n", + "
      \n", + " Kevin Ryan discusses losing money, making money and the importance of presentation.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Steven Levy\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, writer at Wired magazine Steven Levy explains why we need another book a...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steven\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steven Levy on In The Plex\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, writer at Wired magazine Steven Levy discusses his book, In The Plex: Ho...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steven\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steven Levy on Google's Social Media Strategy\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, writer at Wired magazine Steven Levy discusses the social media strategy...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steven\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steven Levy on Android\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, writer at Wired magazine Steven Levy discusses Android and artificial in...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Lark&#39;s\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Lark's Julia Hu Get Engaged on Disrupt\n", + " \n", + "

      \n", + "
      \n", + " Julia Hu gets a surprise proposal and gets engaged onstage at Disrupt New York 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Steven\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Steven Levy on Google\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, writer at Wired magazine Steven Levy discusses how Google shapes our liv...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Chris Dewolfe\n", + " \n", + "

      \n", + "
      \n", + " Andrew Keen interviews CEO of MindJolt Chris Dewolfe at FailCon 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Brian Wong and Roger Dickey\n", + " \n", + "

      \n", + "
      \n", + " Andrew Keen interviews Brian Wong and Roger Dickey at FailCon 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"The\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " The Growth of Mobile Commerce and Payments\n", + " \n", + "

      \n", + "
      \n", + " Erick Schoenfeld interviews Alex Rampell of TrialPay, Stephanie Tilenius of Google Commerce and P...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Peter Gardner\n", + " \n", + "

      \n", + "
      \n", + " Andrew Keen interviews Peter Gardner of Wavepoint Ventures at FailCon 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Ohanian\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Ohanian on the Impact of Jobs and Investors' Attitudes\n", + " \n", + "

      \n", + "
      \n", + " Reddit co-founder Alexis Ohanian discusses the \"Bubble\" and Investors' attitudes.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Michael\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Michael Yavonditte on How Hashable Evolved\n", + " \n", + "

      \n", + "
      \n", + " Hashable CEO Michale Yavonditte explains how the service evolved.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Erik Brynjolfsson and Andrew McAfee\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Erik Brynjolfsson and Andrew McAfee at Techonomy ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"David\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " David Kirkpatrick on The Facebook Effect\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen and David Kirkpatrick discuss the book The Facebook Effect a...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Mike\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Mike McCue on the TellMe Years\n", + " \n", + "

      \n", + "
      \n", + " Mike McCue relates how he survived the first dot-com crash during his TellMe years.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Mike\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Mike McCue on Why Microsoft Bought TellMe\n", + " \n", + "

      \n", + "
      \n", + " Mike McCue talks about the TellMe years and its being bought by Microsoft.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Mike\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Mike McCue on Moving from Print to Digital Content\n", + " \n", + "

      \n", + "
      \n", + " Flipboard CEO Mike McCue talks about delivering digital content.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Roger\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Roger McNamee on Occupy Wall Street\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Roger McNamee discusses how Occupy Wall Street changes everything.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Roger McNamee\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Roger McNamee at Techonomy Tucson 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Rift\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Rift Demo – the New MMO\n", + " \n", + "

      \n", + "
      \n", + " We take a look at the Rift booth at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Craig Mundie\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Craig Mundie at Techonomy Tucson 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On on Net Neutrality\n", + " \n", + "

      \n", + "
      \n", + " Andrew Keen talks with Richard Bennett, Larry Downes, Michael Masnick and Gigi Sohn about the FCC...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Sony\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Sony PSVita at a Glance\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch take a look at the upcoming portable Playstation Vita at the E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Capcom\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Capcom Booth Demonstration – E3 2011\n", + " \n", + "

      \n", + "
      \n", + " Techrunch Takes a look at the Capcom demonstration at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"End\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " End of Nations Demo\n", + " \n", + "

      \n", + "
      \n", + " Techrunch takes a look at the upcomming MMO End of Nations at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Seth Priebatsch\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Seth Priebatsch at Fast Company's Innovation ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Demo\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Demo – Magic The Gathering: Tactics\n", + " \n", + "

      \n", + "
      \n", + " Tech Crunch Take a look at the newest Magic the Gathering game at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Sony\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Sony Booth Demonstration – E3 2011\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch take a look at Sony's booth at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Peter Bell\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Peter Bell at Fast Company's Innovation Uncen...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Lauren Anderson\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Lauren Anderson at Fast Company's Innovation ...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with David Cush\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews David Cush at Fast Company's Innovation Uncen...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Robert Safian\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Robert Safian at Fast Company's Innovation Un...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Chris\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Chris Sacca on the Obama Presidential Campaign\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Chris Sacca tells Andrew Keen about the Obama election campaign, changes...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Keen\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Keen On with Alison Moore\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Andrew Keen interviews Alison Moore at Fast Company's Innovation Unc...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Nox\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Nox Audio Wifi Headset\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch take a look at the Nox booth at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Chris\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Chris Sacca on the Investment Sector\n", + " \n", + "

      \n", + "
      \n", + " In this Keen On episode, Chris Sacca tells Andrew Keen what he has learnt about the investment sc...\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"J\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " J Dome Projector Screen\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch take a look at the J Dome, an immersive projection gaming experience at E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"IndieCade\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " IndieCade E3 Presentation\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch tries some of the indue games demonstrated E3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \"Interview\n", + " \n", + " \n", + " play\n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "

      \n", + " \n", + " Interview With \"Firefox\" and \"Ice Queen\"\n", + " \n", + "

      \n", + "
      \n", + " TechCrunch talk to the actors who work at the boothsE3 2011.\n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + " \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \"dot\n", + " \"dot\n", + " \n", + " \n", + " \"\"\n", + " \n", + " \n", + " \n", + "
      \n", + "
      \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \"dot\n", + " \n", + " \"dot\n", + " \"dot\n", + " \"dot\n", + " \"dot\n", + " \"dot\n", + " \"dot\n", + " \n", + "\n" + ] + } + ], + "source": [ + "print(video_soup.prettify()) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Exercise*: Please extract the link, title, content, author, and time of the videos, combine the data into a pandas `DataFrame`, and save the output to a `.csv` file." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "# write your codes here\n", + "video_list = video_soup.find_all('article', {'class':'post-block'})" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "160" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(video_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "
      \"Puttingplay

      Putting Robots to Work

      We’ve seen the demos and the viral videos, but moving from research to real world is its own comp...
      " + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'/video/putting-robots-to-work-2/'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0].find('a').get('href') #link" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Putting Robots to Work'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0].find('a').get_text() #title" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'We’ve seen the demos and the viral videos, but moving from research to real world is its own comp...'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0].find('div', {'class':'post-block__content'}).get_text(strip=True) #content" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'TC Video'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0].find('span', {'class':'river-byline__authors'}).get_text(strip=True) #author" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'6:05 AM GMT+8•July 22, 2022'" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "video_list[0].time.get_text(strip=True) #time" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      linktitlecontentauthortime
      0/video/putting-robots-to-work-2/Putting Robots to WorkWe’ve seen the demos and the viral videos, but...TC Video6:05 AM GMT+8•July 22, 2022
      1/video/shaping-robots-environments-and-people-...Shaping Robots, Environments, and People for H...As robots and AI begin to pervade everyday lif...TC Video5:40 AM GMT+8•July 22, 2022
      2/video/from-cage-to-stage-commercializing-ai-a...From Cage to Stage: Commercializing AI and Rob...What does it take to bring a robot or AI proce...TC Video5:10 AM GMT+8•July 22, 2022
      3/video/education-first/Education FIRSTFrom the Segway to iBot to AutoSyringe, Dean K...TC Video4:35 AM GMT+8•July 22, 2022
      4/video/techcrunch-robotics-pitch-off/TechCrunch Robotics Pitch-offThe industry’s brightest entrepreneurs will ta...TC Video4:10 AM GMT+8•July 22, 2022
      ..................
      155/unified-video/nox-audio-wifi-headset/Nox Audio Wifi HeadsetTechCrunch take a look at the Nox booth at E3 ...TC Video10:54 PM GMT+8•March 16, 2023
      156/unified-video/chris-sacca-on-the-investment-s...Chris Sacca on the Investment SectorIn this Keen On episode, Chris Sacca tells And...TC Video10:54 PM GMT+8•March 16, 2023
      157/unified-video/j-dome-projector-screen/J Dome Projector ScreenTechCrunch take a look at the J Dome, an immer...TC Video10:54 PM GMT+8•March 16, 2023
      158/unified-video/indiecade-e3-presentation/IndieCade E3 PresentationTechCrunch tries some of the indue games demon...TC Video10:54 PM GMT+8•March 16, 2023
      159/unified-video/interview-with-firefox-and-ice-...Interview With \"Firefox\" and \"Ice Queen\"TechCrunch talk to the actors who work at the ...TC Video10:54 PM GMT+8•March 16, 2023
      \n", + "

      160 rows × 5 columns

      \n", + "
      " + ], + "text/plain": [ + " link \\\n", + "0 /video/putting-robots-to-work-2/ \n", + "1 /video/shaping-robots-environments-and-people-... \n", + "2 /video/from-cage-to-stage-commercializing-ai-a... \n", + "3 /video/education-first/ \n", + "4 /video/techcrunch-robotics-pitch-off/ \n", + ".. ... \n", + "155 /unified-video/nox-audio-wifi-headset/ \n", + "156 /unified-video/chris-sacca-on-the-investment-s... \n", + "157 /unified-video/j-dome-projector-screen/ \n", + "158 /unified-video/indiecade-e3-presentation/ \n", + "159 /unified-video/interview-with-firefox-and-ice-... \n", + "\n", + " title \\\n", + "0 Putting Robots to Work \n", + "1 Shaping Robots, Environments, and People for H... \n", + "2 From Cage to Stage: Commercializing AI and Rob... \n", + "3 Education FIRST \n", + "4 TechCrunch Robotics Pitch-off \n", + ".. ... \n", + "155 Nox Audio Wifi Headset \n", + "156 Chris Sacca on the Investment Sector \n", + "157 J Dome Projector Screen \n", + "158 IndieCade E3 Presentation \n", + "159 Interview With \"Firefox\" and \"Ice Queen\" \n", + "\n", + " content author \\\n", + "0 We’ve seen the demos and the viral videos, but... TC Video \n", + "1 As robots and AI begin to pervade everyday lif... TC Video \n", + "2 What does it take to bring a robot or AI proce... TC Video \n", + "3 From the Segway to iBot to AutoSyringe, Dean K... TC Video \n", + "4 The industry’s brightest entrepreneurs will ta... TC Video \n", + ".. ... ... \n", + "155 TechCrunch take a look at the Nox booth at E3 ... TC Video \n", + "156 In this Keen On episode, Chris Sacca tells And... TC Video \n", + "157 TechCrunch take a look at the J Dome, an immer... TC Video \n", + "158 TechCrunch tries some of the indue games demon... TC Video \n", + "159 TechCrunch talk to the actors who work at the ... TC Video \n", + "\n", + " time \n", + "0 6:05 AM GMT+8•July 22, 2022 \n", + "1 5:40 AM GMT+8•July 22, 2022 \n", + "2 5:10 AM GMT+8•July 22, 2022 \n", + "3 4:35 AM GMT+8•July 22, 2022 \n", + "4 4:10 AM GMT+8•July 22, 2022 \n", + ".. ... \n", + "155 10:54 PM GMT+8•March 16, 2023 \n", + "156 10:54 PM GMT+8•March 16, 2023 \n", + "157 10:54 PM GMT+8•March 16, 2023 \n", + "158 10:54 PM GMT+8•March 16, 2023 \n", + "159 10:54 PM GMT+8•March 16, 2023 \n", + "\n", + "[160 rows x 5 columns]" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "link_list = []\n", + "title_list = []\n", + "content_list = []\n", + "author_list = []\n", + "time_list = []\n", + "\n", + "for video in video_list:\n", + " link_list.append(video.find('a').get('href'))\n", + " title_list.append(video.find('a').get_text(strip=True))\n", + " content_list.append(video.find('div',{'class': 'post-block__content'}).get_text(strip=True))\n", + " author_list.append(video.find('span',{'class': 'river-byline__authors'}).get_text(strip=True))\n", + " time_list.append(video.time.get_text())\n", + "video_list_df = pd.DataFrame({'link': link_list, 'title': title_list, 'content': content_list, 'author': author_list,'time': time_list }) \n", + "video_list_df" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "driver.quit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.13" + }, + "vscode": { + "interpreter": { + "hash": "ad2bdc8ecc057115af97d19610ffacc2b4e99fae6737bb82f5d7fb13d2f2c186" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/course_materials/Topic_6_Pandas_(with answers).ipynb b/course_materials/Topic_6_Pandas_(with answers).ipynb new file mode 100644 index 0000000..3d6e2cd --- /dev/null +++ b/course_materials/Topic_6_Pandas_(with answers).ipynb @@ -0,0 +1,13790 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "cr_lUENJdGW1" + }, + "source": [ + "\n", + "\n", + "\n", + "[Pandas](http://pandas.pydata.org/) is a Python library that provides data structures and functions for fast, easy, and expressive manipulation of *structured data*.\n", + "\n", + "\n", + "\n", + "\n", + "- It provides two main data structures: the `Series` which holds a **1-dimensional sequence** of ***homogeneous*** values, and the `DataFrame`, which holds a ***tabular***, ***heterogeneous*** dataset.\n", + "\n", + "- It also contains a large number of functions and methods to manipulate and summarize `Series` and `DataFrame` objects.\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "id": "yU_LgG6WdGW2" + }, + "outputs": [], + "source": [ + "import pandas as pd # abbreviated as pd conventionally" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "Uv3PBPdW8mU6", + "outputId": "bb76b304-b0df-418c-d9e1-ca819db08816" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "'2.0.3'" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "string" + } + }, + "metadata": {}, + "execution_count": 2 + } + ], + "source": [ + "pd.__version__" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "1pUM0xM48RWJ" + }, + "source": [ + "# 1 `Series` and `DataFrame`\n", + "\n", + "A [`DataFrame`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) represents a ***2-dimensional***, ***tabular*** data structure containing an ***ordered*** collection of columns, each of which can be a different value type (numeric, string, Boolean, etc.).\n", + "\n", + "Previously in web scraping, we have seen:\n", + "```python\n", + "lie_df = pd.DataFrame({'date': date_list, 'lie': lie_list, 'explanation': explanation_list, 'url': url_list})\n", + "```\n", + "\n", + "\n", + "A `DataFrame` can be thought of as a specialization of a Python dictionary. It maps names (i.e., column names or indcies) to a sequence of data series that share the same set of labels (i.e., row names or indices).\n", + "\n", + "\n", + "\n", + "\n", + "
      \n", + "\n", + "Let's build up the above `DataFrame` from scratch based on this component view (column by column):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Tu_Te5Ga8HXb", + "outputId": "fc65c8bb-a16d-4d87-f6f7-b27323cbfe42" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0 Wan Chai\n", + "1 North\n", + "2 Sai Kung\n", + "3 Sha Tin\n", + "dtype: object" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "# https://pandas.pydata.org/docs/reference/api/pandas.Series.html\n", + "\n", + "# a Series can be thought of as a 1-dimensional array with attached labels\n", + "# a set of default indices, consisting of the integers 0 through n-1, are automatically attached\n", + "district_name = pd.Series(['Wan Chai', 'North', 'Sai Kung', 'Sha Tin'])\n", + "district_name" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "afo4Oh1ziCzs", + "outputId": "1dd3b6c3-0a3f-4e1f-a08f-2313582bdbe8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array(['Wan Chai', 'North', 'Sai Kung', 'Sha Tin'], dtype=object)" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ], + "source": [ + "# Return Series as array\n", + "district_name.values" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "B8OMPSkv2Nu6" + }, + "source": [ + "`Array` is similar to `List`, but it requires all elements to be of the same data type. This characteristic is beneficial for certain operations, especially those that are mathematically intensive, as it allows for more efficient data processing." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Im-OAkGQiJnc", + "outputId": "2b34d92b-3761-49ec-bc9a-a60080774b9d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "RangeIndex(start=0, stop=4, step=1)" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ], + "source": [ + "# Return the index of the Series.\n", + "district_name.index" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hp7S6BsD279f", + "outputId": "3aad52f1-afca-4817-df33-c77c5764d294" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[0, 1, 2, 3]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(district_name.index)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "65HQ7NA-8HXc", + "outputId": "0520f329-f831-4294-aa21-dfdb58a0971d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0 150900\n", + "1 310800\n", + "2 448600\n", + "3 648200\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "district_population = pd.Series([150900, 310800, 448600, 648200])\n", + "district_population" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "C4CTdE0Z8HXc", + "outputId": "87cb7bec-8851-434d-8c84-d49459a74c31" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0 9.83\n", + "1 136.61\n", + "2 129.65\n", + "3 68.71\n", + "dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 7 + } + ], + "source": [ + "district_area = pd.Series([9.83, 136.61, 129.65, 68.71])\n", + "district_area" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "B7w5X4KR8HXd", + "outputId": "cbcd4762-d979-4b6a-f689-6f880a43a70b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " District Population Area\n", + "0 Wan Chai 150900 9.83\n", + "1 North 310800 136.61\n", + "2 Sai Kung 448600 129.65\n", + "3 Sha Tin 648200 68.71" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DistrictPopulationArea
      0Wan Chai1509009.83
      1North310800136.61
      2Sai Kung448600129.65
      3Sha Tin64820068.71
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "HK_district1", + "summary": "{\n \"name\": \"HK_district1\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"District\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"North\",\n \"Sha Tin\",\n \"Wan Chai\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210983,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 4,\n \"samples\": [\n 310800,\n 648200,\n 150900\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.35022493638925,\n \"min\": 9.83,\n \"max\": 136.61,\n \"num_unique_values\": 4,\n \"samples\": [\n 136.61,\n 68.71,\n 9.83\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 8 + } + ], + "source": [ + "# https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html\n", + "\n", + "HK_district1 = pd.DataFrame({'District': district_name,\n", + " 'Population': district_population,\n", + " 'Area': district_area})\n", + "HK_district1" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "J5p1mL3o8HXe" + }, + "source": [ + "A `Series` can also be created with user supplied index.\n", + "\n", + "Apart from making data more readable, the explicit index definition gives the `Series` object additional capabilities such as label-based selection and operation alignment." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qxBb1vHP8HXe", + "outputId": "69f9e3a0-fbf4-442d-bd2b-400b79b7ea7f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Sai Kung 448600\n", + "Sha Tin 648200\n", + "Wan Chai 150900\n", + "North 310800\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ], + "source": [ + "district_population2 = pd.Series([448600, 648200, 150900, 310800],\n", + " index=['Sai Kung', 'Sha Tin', 'Wan Chai', 'North'])\n", + "district_population2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "vSYLyA4_8HXf", + "outputId": "9dea60e2-b95d-4179-9af4-17c8900e59b3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Wan Chai 9.83\n", + "North 136.61\n", + "Sai Kung 129.65\n", + "Sha Tin 68.71\n", + "dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 10 + } + ], + "source": [ + "district_area2 = pd.Series([9.83, 136.61, 129.65, 68.71],\n", + " index=['Wan Chai', 'North', 'Sai Kung', 'Sha Tin'])\n", + "district_area2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "oDgT-R7G8HXg", + "outputId": "37fbac32-2599-4768-b69d-8a2df9d94064" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area\n", + "North 310800 136.61\n", + "Sai Kung 448600 129.65\n", + "Sha Tin 648200 68.71\n", + "Wan Chai 150900 9.83" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationArea
      North310800136.61
      Sai Kung448600129.65
      Sha Tin64820068.71
      Wan Chai1509009.83
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "HK_district2", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210983,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 4,\n \"samples\": [\n 448600,\n 150900,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.35022493638925,\n \"min\": 9.83,\n \"max\": 136.61,\n \"num_unique_values\": 4,\n \"samples\": [\n 129.65,\n 9.83,\n 136.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "HK_district2 = pd.DataFrame({'Population': district_population2, 'Area': district_area2})\n", + "HK_district2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "K_PNxiU08HXg" + }, + "source": [ + "The data from the two `Series` are ***aligned via index labels*** (also sorted in the result).\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "0w_xGMOuJfpT", + "outputId": "ebd5a526-39c0-4863-83e1-c670dff7aa02" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Index(['District', 'Population', 'Area'], dtype='object')" + ] + }, + "metadata": {}, + "execution_count": 12 + } + ], + "source": [ + "# Return the column labels of the DataFrame\n", + "HK_district1.columns" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xqTcdEWs8HXh" + }, + "source": [ + "Individual columns of a `DataFrame` can be accessed with dictionary-style indexing." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "0wZPsdmz8HXh", + "outputId": "b64b3f74-b56c-4528-db8f-868a11373a37" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0 150900\n", + "1 310800\n", + "2 448600\n", + "3 648200\n", + "Name: Population, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ], + "source": [ + "HK_district1['Population']" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "zWEFJPSg4AqL" + }, + "source": [ + "They can also be accessed using the attribute reference notation as if they are the attributes of a `DataFrame`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "meGHKttf8HXh", + "outputId": "de99d8a3-2d8f-4ee0-b169-07ccce39c930" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "North 136.61\n", + "Sai Kung 129.65\n", + "Sha Tin 68.71\n", + "Wan Chai 9.83\n", + "Name: Area, dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ], + "source": [ + "HK_district2.Area" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "1rB6e1_wVhux", + "outputId": "070555a2-cab7-42d8-883f-11979108cbd3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "North 310800\n", + "Sai Kung 448600\n", + "Sha Tin 648200\n", + "Wan Chai 150900\n", + "Name: Population, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ], + "source": [ + "HK_district2.Population" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "t_RelPLOVQJc" + }, + "source": [ + "Because pandas is built on top of NumPy, `Series` and `DataFrame` objects support **vectorized operations**. Vectorized operations are a powerful feature of Python that allow you to apply a function or an operation to multiple elements of an array or a dataframe at once, instead of using loops. This can save time, improve your code readability, and reduce your memory usage." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "msdHWhpMACwm", + "outputId": "fc324144-caaa-4e03-d12f-32fa1d508796" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "North 310800 136.61 2275.089671\n", + "Sai Kung 448600 129.65 3460.084844\n", + "Sha Tin 648200 68.71 9433.852423\n", + "Wan Chai 150900 9.83 15350.966429" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      North310800136.612275.089671
      Sai Kung448600129.653460.084844
      Sha Tin64820068.719433.852423
      Wan Chai1509009.8315350.966429
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "HK_district2", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210983,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 4,\n \"samples\": [\n 448600,\n 150900,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.35022493638925,\n \"min\": 9.83,\n \"max\": 136.61,\n \"num_unique_values\": 4,\n \"samples\": [\n 129.65,\n 9.83,\n 136.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 6025.790769823514,\n \"min\": 2275.0896713271354,\n \"max\": 15350.966429298067,\n \"num_unique_values\": 4,\n \"samples\": [\n 3460.0848438102585,\n 15350.966429298067,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "# this assignment form of indexing creates a new column\n", + "HK_district2['Density'] = HK_district2.Population / HK_district2.Area\n", + "HK_district2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "XWj8QYIEo3FU" + }, + "source": [ + "There are many ways to create a DataFrame. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html\n", + "\n", + "Another usual way of creating a DataFrame is by using `pd.DataFrame(data, columns=[column_names],index=[row_names])` explicitly.\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "h-eiSsbHpH08", + "outputId": "55260d3a-e87b-4a3e-c87d-7752ea272105" + }, + "outputs": [ + { + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "summary": "{\n \"name\": \"df\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"a\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7071067811865476,\n \"min\": 3.0,\n \"max\": 4.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 4.0,\n 3.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"b\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7071067811865476,\n \"min\": 7.0,\n \"max\": 8.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 7.0,\n 8.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}", + "type": "dataframe", + "variable_name": "df" + }, + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ab
      first3.08.0
      second4.07.0
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "text/plain": [ + " a b\n", + "first 3.0 8.0\n", + "second 4.0 7.0" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.DataFrame(data=[[3.0, 8.0], [4.0, 7.0]], columns=['a', 'b'], index=['first','second'])\n", + "df" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "n9aeaNrcdGYS" + }, + "source": [ + "\n", + "---\n", + "\n", + "
      \n", + "\n", + "# 2 Data Selection in `DataFrame`s\n", + "\n", + "\n", + "`DataFrame` support both ***label-based*** indexing and ***location-based*** indexing.\n", + "\n", + "Pandas provids two indexer attributes that explicitly expose which indexing scheme to apply:\n", + "\n", + "- The `loc` attribute uses ***label-based*** indexing:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "BA4iaMZrdGYc", + "outputId": "bd8ee1c3-bdc5-48bd-c73a-be507095c2a7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "129.65" + ] + }, + "metadata": {}, + "execution_count": 18 + } + ], + "source": [ + "HK_district2.loc['Sai Kung', 'Area']" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "5Mc4hyUU7qzY" + }, + "source": [ + "- The `loc` attribute can be used for slicing based on labels. It can handle slices, single labels, and lists of labels. Both the start and the stop of the slice are inclusive." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "DExCstxjdGYf", + "outputId": "95aa7d0c-03ba-46a6-d470-82e9bdc27ab2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area\n", + "Sai Kung 448600 129.65\n", + "Sha Tin 648200 68.71\n", + "Wan Chai 150900 9.83" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationArea
      Sai Kung448600129.65
      Sha Tin64820068.71
      Wan Chai1509009.83
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 250257,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 3,\n \"samples\": [\n 448600,\n 648200,\n 150900\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.912951298807954,\n \"min\": 9.83,\n \"max\": 129.65,\n \"num_unique_values\": 3,\n \"samples\": [\n 129.65,\n 68.71,\n 9.83\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 19 + } + ], + "source": [ + "# slicing selects contiguous rows and columns\n", + "# but the last label in inclusive this time\n", + "\n", + "HK_district2.loc['Sai Kung':'Wan Chai', :'Area']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "stvLLsCBdGYg", + "outputId": "d450f23e-ffdb-4883-e656-59f29363cf47" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Density Population\n", + "Sai Kung 3460.084844 448600\n", + "Wan Chai 15350.966429 150900" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DensityPopulation
      Sai Kung3460.084844448600
      Wan Chai15350.966429150900
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \" ['Density', 'Population']]\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8408.123003384675,\n \"min\": 3460.0848438102585,\n \"max\": 15350.966429298067,\n \"num_unique_values\": 2,\n \"samples\": [\n 15350.966429298067,\n 3460.0848438102585\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210505,\n \"min\": 150900,\n \"max\": 448600,\n \"num_unique_values\": 2,\n \"samples\": [\n 150900,\n 448600\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 20 + } + ], + "source": [ + "# using indexing lists (or tuples) can select non-contiguous rows and columns\n", + "# can also present them in a different order, e.g., make Density precede Population\n", + "\n", + "HK_district2.loc[['Sai Kung', 'Wan Chai'],\n", + " ['Density', 'Population']]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "p3bklxjn_xY6" + }, + "source": [ + "Boolean indexing selects items that satisfy certain criteria; important for data filtering." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "Q9P1vA4h_0Wt", + "outputId": "9ebdd628-fe53-4bcc-d8b2-dd426fad8704" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Density\n", + "North 310800 2275.089671\n", + "Sha Tin 648200 9433.852423" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationDensity
      North3108002275.089671
      Sha Tin6482009433.852423
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 238577,\n \"min\": 310800,\n \"max\": 648200,\n \"num_unique_values\": 2,\n \"samples\": [\n 648200,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5062.009686774815,\n \"min\": 2275.0896713271354,\n \"max\": 9433.852423228062,\n \"num_unique_values\": 2,\n \"samples\": [\n 9433.852423228062,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 21 + } + ], + "source": [ + "import numpy as np\n", + "HK_district2.loc[np.array([True, False, True, False]), ['Population', 'Density']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "g3gB6wGvdGYk", + "outputId": "77bd1fe1-30cf-4d9b-9273-e3e4c310cd52" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Density\n", + "North 310800 2275.089671\n", + "Sai Kung 448600 3460.084844" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationDensity
      North3108002275.089671
      Sai Kung4486003460.084844
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 97439,\n \"min\": 310800,\n \"max\": 448600,\n \"num_unique_values\": 2,\n \"samples\": [\n 448600,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 837.9181221361389,\n \"min\": 2275.0896713271354,\n \"max\": 3460.0848438102585,\n \"num_unique_values\": 2,\n \"samples\": [\n 3460.0848438102585,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 23 + } + ], + "source": [ + "# differet types of indexing (and slicing) can be mixedly used\n", + "\n", + "HK_district2.loc[HK_district2.Area > 100, ['Population', 'Density']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "2_ZI-qRWXyCS", + "outputId": "850b5fc6-0dd6-43ab-efc9-0414a4a3229c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "North True\n", + "Sai Kung True\n", + "Sha Tin False\n", + "Wan Chai False\n", + "Name: Area, dtype: bool" + ] + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "HK_district2.Area > 100" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 81 + }, + "id": "dYhhQnjf4AKP", + "outputId": "5c1d0050-ee59-4d51-cdef-3d46283773c6" + }, + "outputs": [ + { + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "summary": "{\n \"name\": \" ['Population', 'Density']]\",\n \"rows\": 1,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 648200,\n \"max\": 648200,\n \"num_unique_values\": 1,\n \"samples\": [\n 648200\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 9433.852423228062,\n \"max\": 9433.852423228062,\n \"num_unique_values\": 1,\n \"samples\": [\n 9433.852423228062\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}", + "type": "dataframe" + }, + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationDensity
      Sha Tin6482009433.852423
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "
      \n", + "
      \n" + ], + "text/plain": [ + " Population Density\n", + "Sha Tin 648200 9433.852423" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Boolean operators are ~, &, and | are used for selection\n", + "\n", + "HK_district2.loc[~(HK_district2.Area > 100) & (HK_district2.Population > 200000),\n", + " ['Population', 'Density']]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MShWN8sU5Iei" + }, + "source": [ + "Pandas also provide a handy helper function that allows us to query data with less verbose query strings: `query()` method. It is a powerful tool for filtering `DataFrame` rows using a concise and readable expression syntax.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 80 + }, + "id": "jzylxSwi5ZS9", + "outputId": "c0aea66c-db32-48fc-b443-7b696b929640" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "Sha Tin 648200 68.71 9433.852423" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      Sha Tin64820068.719433.852423
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 1,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 648200,\n \"max\": 648200,\n \"num_unique_values\": 1,\n \"samples\": [\n 648200\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 68.71,\n \"max\": 68.71,\n \"num_unique_values\": 1,\n \"samples\": [\n 68.71\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 9433.852423228062,\n \"max\": 9433.852423228062,\n \"num_unique_values\": 1,\n \"samples\": [\n 9433.852423228062\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 24 + } + ], + "source": [ + "HK_district2.query('~ (Area > 100) & (Population > 200000)')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 80 + }, + "id": "7S3OQroFBBko", + "outputId": "728ddb31-44a9-42cf-97da-a975c7b685cb" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "Sai Kung 448600 129.65 3460.084844" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      Sai Kung448600129.653460.084844
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 1,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 448600,\n \"max\": 448600,\n \"num_unique_values\": 1,\n \"samples\": [\n 448600\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 129.65,\n \"max\": 129.65,\n \"num_unique_values\": 1,\n \"samples\": [\n 129.65\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 3460.0848438102585,\n \"max\": 3460.0848438102585,\n \"num_unique_values\": 1,\n \"samples\": [\n 3460.0848438102585\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 25 + } + ], + "source": [ + "HK_district2.query('index == \"Sai Kung\"')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "uo9WD616KiVw", + "outputId": "cb8072a2-7914-4d63-d41e-22c725cd38c8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "Sai Kung 448600 129.65 3460.084844\n", + "Sha Tin 648200 68.71 9433.852423" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      Sai Kung448600129.653460.084844
      Sha Tin64820068.719433.852423
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 141138,\n \"min\": 448600,\n \"max\": 648200,\n \"num_unique_values\": 2,\n \"samples\": [\n 648200,\n 448600\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 43.09108724550821,\n \"min\": 68.71,\n \"max\": 129.65,\n \"num_unique_values\": 2,\n \"samples\": [\n 68.71,\n 129.65\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4224.091564638677,\n \"min\": 3460.0848438102585,\n \"max\": 9433.852423228062,\n \"num_unique_values\": 2,\n \"samples\": [\n 9433.852423228062,\n 3460.0848438102585\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 27 + } + ], + "source": [ + "# Can take a 1-argument function. The x passed to the lambda is the DataFrame being sliced.\n", + "\n", + "HK_district2.loc[lambda x: [i[0]=='S' for i in x.index], :]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "NMrEnfVBBh1c", + "outputId": "bef02d96-02bb-45c0-ac39-07c065f0ffea" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Index(['North', 'Sai Kung', 'Sha Tin', 'Wan Chai'], dtype='object')" + ] + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "HK_district2.index" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "9sR1oXZNCZxZ" + }, + "source": [ + "If the second argument (column labels) is omitted, `.loc` will return all columns for the specified rows." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "EpR31NUiCVIJ", + "outputId": "5c368e77-16a7-488f-cf04-ca70a85d0408" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "Sai Kung 448600 129.65 3460.084844\n", + "Sha Tin 648200 68.71 9433.852423" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      Sai Kung448600129.653460.084844
      Sha Tin64820068.719433.852423
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 141138,\n \"min\": 448600,\n \"max\": 648200,\n \"num_unique_values\": 2,\n \"samples\": [\n 648200,\n 448600\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 43.09108724550821,\n \"min\": 68.71,\n \"max\": 129.65,\n \"num_unique_values\": 2,\n \"samples\": [\n 68.71,\n 129.65\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4224.091564638677,\n \"min\": 3460.0848438102585,\n \"max\": 9433.852423228062,\n \"num_unique_values\": 2,\n \"samples\": [\n 9433.852423228062,\n 3460.0848438102585\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 28 + } + ], + "source": [ + "HK_district2.loc[lambda x: [i[0]=='S' for i in x.index]]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "K76qH-PcdGYo" + }, + "source": [ + "- The `iloc` attribute uses Python-style ***location-based*** indexing:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "XKhgaIyNY9th", + "outputId": "03735dfe-5d16-4420-fd39-16e58290e8da" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area Density\n", + "North 310800 136.61 2275.089671\n", + "Sai Kung 448600 129.65 3460.084844\n", + "Sha Tin 648200 68.71 9433.852423\n", + "Wan Chai 150900 9.83 15350.966429" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationAreaDensity
      North310800136.612275.089671
      Sai Kung448600129.653460.084844
      Sha Tin64820068.719433.852423
      Wan Chai1509009.8315350.966429
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "HK_district2", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210983,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 4,\n \"samples\": [\n 448600,\n 150900,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.35022493638925,\n \"min\": 9.83,\n \"max\": 136.61,\n \"num_unique_values\": 4,\n \"samples\": [\n 129.65,\n 9.83,\n 136.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 6025.790769823514,\n \"min\": 2275.0896713271354,\n \"max\": 15350.966429298067,\n \"num_unique_values\": 4,\n \"samples\": [\n 3460.0848438102585,\n 15350.966429298067,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "HK_district2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "iI2cWX6xdGYp", + "outputId": "328bea5b-fe28-4de2-c0b7-4eeb7cd0139b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "129.65" + ] + }, + "metadata": {}, + "execution_count": 30 + } + ], + "source": [ + "# 0-based indexing; starting from zero\n", + "HK_district2.iloc[1, 1]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "hDbkTrEqZISx", + "outputId": "38b90700-cc1b-4e21-d9e5-feeae05b61cf" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Area\n", + "Sai Kung 448600 129.65\n", + "Sha Tin 648200 68.71\n", + "Wan Chai 150900 9.83" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationArea
      Sai Kung448600129.65
      Sha Tin64820068.71
      Wan Chai1509009.83
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 250257,\n \"min\": 150900,\n \"max\": 648200,\n \"num_unique_values\": 3,\n \"samples\": [\n 448600,\n 648200,\n 150900\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 59.912951298807954,\n \"min\": 9.83,\n \"max\": 129.65,\n \"num_unique_values\": 3,\n \"samples\": [\n 129.65,\n 68.71,\n 9.83\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 31 + } + ], + "source": [ + "# the last index is exclusive as with regular Python slicing\n", + "HK_district2.iloc[1:4, :2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "ymCsTpxxaD_l", + "outputId": "4f87e9ed-06df-4de8-b5cb-1f82a5203b38" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Density Population\n", + "Sai Kung 3460.084844 448600\n", + "Wan Chai 15350.966429 150900" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DensityPopulation
      Sai Kung3460.084844448600
      Wan Chai15350.966429150900
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8408.123003384675,\n \"min\": 3460.0848438102585,\n \"max\": 15350.966429298067,\n \"num_unique_values\": 2,\n \"samples\": [\n 15350.966429298067,\n 3460.0848438102585\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 210505,\n \"min\": 150900,\n \"max\": 448600,\n \"num_unique_values\": 2,\n \"samples\": [\n 150900,\n 448600\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 32 + } + ], + "source": [ + "# select non-contiguous rows and columns\n", + "HK_district2.iloc[[1, 3], [2, 0]]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "PpWB3RFKEE0W" + }, + "source": [ + "The `.iloc` is primarily integer position based (from 0 to length-1 of the axis), but may also be used with a boolean array." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "wuPmilQLdGYy", + "outputId": "c7398335-05e0-46e1-e226-46d61252bde0", + "scrolled": true + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Density\n", + "North 310800 2275.089671\n", + "Sai Kung 448600 3460.084844" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationDensity
      North3108002275.089671
      Sai Kung4486003460.084844
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 97439,\n \"min\": 310800,\n \"max\": 448600,\n \"num_unique_values\": 2,\n \"samples\": [\n 448600,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 837.9181221361389,\n \"min\": 2275.0896713271354,\n \"max\": 3460.0848438102585,\n \"num_unique_values\": 2,\n \"samples\": [\n 3460.0848438102585,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 34 + } + ], + "source": [ + "# what HK_district2.Area returns is a Series\n", + "# iloc can only take a NumPy array, which can be accessed via .values\n", + "HK_district2.iloc[(HK_district2.Area > 100).values, [0, 2]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Gr7Yk_SHNh0h", + "outputId": "65c0428b-0cbd-47fb-c9cc-056fba605057" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array([ True, True, False, False])" + ] + }, + "metadata": {}, + "execution_count": 33 + } + ], + "source": [ + "(HK_district2.Area > 100).values" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "WmyrwCr5Nmaj", + "outputId": "5c7eb563-c70c-453b-8ade-2d52b028a6e7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population Density\n", + "North 310800 2275.089671\n", + "Sai Kung 448600 3460.084844" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PopulationDensity
      North3108002275.089671
      Sai Kung4486003460.084844
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 97439,\n \"min\": 310800,\n \"max\": 448600,\n \"num_unique_values\": 2,\n \"samples\": [\n 448600,\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Density\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 837.9181221361389,\n \"min\": 2275.0896713271354,\n \"max\": 3460.0848438102585,\n \"num_unique_values\": 2,\n \"samples\": [\n 3460.0848438102585,\n 2275.0896713271354\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 35 + } + ], + "source": [ + "HK_district2.iloc[(HK_district2.Area > 100).values, [True, False, True]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "PyjoPDkNIkZj", + "outputId": "d41fa286-2138-4993-9711-bd421e8d957c" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Area\n", + "North 136.61\n", + "Sha Tin 68.71" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Area
      North136.61
      Sha Tin68.71
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \" lambda x: [i[0]=='A' for i in x\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Area\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 48.01255044256659,\n \"min\": 68.71,\n \"max\": 136.61,\n \"num_unique_values\": 2,\n \"samples\": [\n 68.71,\n 136.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 36 + } + ], + "source": [ + "# Can take a 1-argument function. The x passed to the lambda is the DataFrame being sliced.\n", + "\n", + "HK_district2.iloc[lambda x: [i for i in range(len(x)) if i % 2 == 0],\n", + " lambda x: [i[0]=='A' for i in x.columns]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-Z5fakGdEWN6", + "outputId": "9b72ed50-3ce6-473b-9643-1a2bae31369e" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "range(0, 4)" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "range(len(HK_district2))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "e0p_b4FFEiaG", + "outputId": "1fd23d16-d543-4eb7-aa6f-6c1e6843d597" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Population', 'Area', 'Density'], dtype='object')" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "HK_district2.columns" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2TQdkZzoqI8Y" + }, + "source": [ + "*Exercise*:\n", + "Can you select district(s) whose name is shorter than 6 characters and show their `Population`?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jHOnVubqsDTn", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 80 + }, + "outputId": "f8a50661-4fac-48e5-8e3a-c4da479b8964" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Population\n", + "North 310800" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Population
      North310800
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"HK_district2\",\n \"rows\": 1,\n \"fields\": [\n {\n \"column\": \"Population\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 310800,\n \"max\": 310800,\n \"num_unique_values\": 1,\n \"samples\": [\n 310800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 37 + } + ], + "source": [ + "# write your code here\n", + "\n", + "HK_district2.iloc[lambda x: [len(i)<6 for i in x.index],[0]]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "gN_jwMl-dGZy" + }, + "source": [ + "---\n", + "\n", + "
      \n", + "\n", + "# 3 Importing and Exporting Data\n", + "\n", + "Pandas features a number of [functions](https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html) for reading tabular data as a `DataFrame` object. Among them, [`read_csv()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) is likely the one we'll use the most:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "UTYNJD03Yb0b", + "outputId": "4128a707-1d22-4c27-a37c-836760f98730" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date GOOG APPL AMZN\n", + "0 2015/5/1 537.900024 120.220688 422.869995\n", + "1 2015/5/4 540.780029 119.987633 423.040009\n", + "2 2015/5/5 530.799988 117.283951 421.190002\n", + "3 2015/5/6 524.219971 116.547424 419.100006" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DateGOOGAPPLAMZN
      02015/5/1537.900024120.220688422.869995
      12015/5/4540.780029119.987633423.040009
      22015/5/5530.799988117.283951421.190002
      32015/5/6524.219971116.547424419.100006
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "sp", + "summary": "{\n \"name\": \"sp\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"2015/5/4\",\n \"2015/5/6\",\n \"2015/5/1\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"GOOG\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 7.432934330450454,\n \"min\": 524.219971,\n \"max\": 540.780029,\n \"num_unique_values\": 4,\n \"samples\": [\n 540.780029,\n 524.219971,\n 537.900024\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"APPL\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.8676860370617223,\n \"min\": 116.547424,\n \"max\": 120.220688,\n \"num_unique_values\": 4,\n \"samples\": [\n 119.987633,\n 116.547424,\n 120.220688\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"AMZN\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.834355725235249,\n \"min\": 419.100006,\n \"max\": 423.040009,\n \"num_unique_values\": 4,\n \"samples\": [\n 423.040009,\n 419.100006,\n 422.869995\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 38 + } + ], + "source": [ + "sp = pd.read_csv(\"https://raw.githubusercontent.com/justinjiajia/datafiles/master/adj_closing_sub.csv\")\n", + "sp" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "BPXlruYGdGZ2" + }, + "source": [ + "The corresponding writer functions are object methods that are accessed like [`DataFrame.to_csv()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html):\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Hmt1EnUJdGZ5" + }, + "outputs": [], + "source": [ + "sp.to_csv(\"stockprice_new.csv\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "v38QUl8udGZ8" + }, + "source": [ + "\n", + "---\n", + "\n", + "
      \n", + "\n", + "# 4 Computing Summary and Descriptive Statistics\n", + "\n", + "\n", + "`DataFrame` objects are equipped with common mathematical and statistical [methods](https://pandas.pydata.org/pandas-docs/stable/reference/frame.html#computations-descriptive-stats) for column-wise computations (or row-wise by setting `axis=1`):\n", + "\n", + "- Most of them produce aggregates:\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Ke5EX-BYdGZ9", + "outputId": "86254c4e-b11b-4da9-cfe0-63ee26dee4c6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "GOOG 533.425003\n", + "APPL 118.509924\n", + "dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 39 + } + ], + "source": [ + "sp[['GOOG', 'APPL']].mean()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "nBb16pzt8mX3", + "outputId": "a37118d5-d770-4007-8801-b4a4b0acb28f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Date 4\n", + "APPL 4\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 40 + } + ], + "source": [ + "sp[['Date', 'APPL']].nunique()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "pgedhvgAZjhs", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c383a0fe-8a75-4381-d2ad-61462e03a8cb" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['AMZN',\n", + " 'APPL',\n", + " 'Date',\n", + " 'GOOG',\n", + " 'T',\n", + " '_AXIS_LEN',\n", + " '_AXIS_ORDERS',\n", + " '_AXIS_TO_AXIS_NUMBER',\n", + " '_HANDLED_TYPES',\n", + " '__abs__',\n", + " '__add__',\n", + " '__and__',\n", + " '__annotations__',\n", + " '__array__',\n", + " '__array_priority__',\n", + " '__array_ufunc__',\n", + " '__bool__',\n", + " '__class__',\n", + " '__contains__',\n", + " '__copy__',\n", + " '__dataframe__',\n", + " '__deepcopy__',\n", + " '__delattr__',\n", + " '__delitem__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__divmod__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__finalize__',\n", + " '__floordiv__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattr__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__getstate__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__iadd__',\n", + " '__iand__',\n", + " '__ifloordiv__',\n", + " '__imod__',\n", + " '__imul__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__invert__',\n", + " '__ior__',\n", + " '__ipow__',\n", + " '__isub__',\n", + " '__iter__',\n", + " '__itruediv__',\n", + " '__ixor__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__matmul__',\n", + " '__mod__',\n", + " '__module__',\n", + " '__mul__',\n", + " '__ne__',\n", + " '__neg__',\n", + " '__new__',\n", + " '__nonzero__',\n", + " '__or__',\n", + " '__pos__',\n", + " '__pow__',\n", + " '__radd__',\n", + " '__rand__',\n", + " '__rdivmod__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__rfloordiv__',\n", + " '__rmatmul__',\n", + " '__rmod__',\n", + " '__rmul__',\n", + " '__ror__',\n", + " '__round__',\n", + " '__rpow__',\n", + " '__rsub__',\n", + " '__rtruediv__',\n", + " '__rxor__',\n", + " '__setattr__',\n", + " '__setitem__',\n", + " '__setstate__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__sub__',\n", + " '__subclasshook__',\n", + " '__truediv__',\n", + " '__weakref__',\n", + " '__xor__',\n", + " '_accessors',\n", + " '_accum_func',\n", + " '_add_numeric_operations',\n", + " '_agg_examples_doc',\n", + " '_agg_summary_and_see_also_doc',\n", + " '_align_frame',\n", + " '_align_series',\n", + " '_append',\n", + " '_arith_method',\n", + " '_as_manager',\n", + " '_attrs',\n", + " '_box_col_values',\n", + " '_can_fast_transpose',\n", + " '_check_inplace_and_allows_duplicate_labels',\n", + " '_check_inplace_setting',\n", + " '_check_is_chained_assignment_possible',\n", + " '_check_label_or_level_ambiguity',\n", + " '_check_setitem_copy',\n", + " '_clear_item_cache',\n", + " '_clip_with_one_bound',\n", + " '_clip_with_scalar',\n", + " '_cmp_method',\n", + " '_combine_frame',\n", + " '_consolidate',\n", + " '_consolidate_inplace',\n", + " '_construct_axes_dict',\n", + " '_construct_result',\n", + " '_constructor',\n", + " '_constructor_sliced',\n", + " '_create_data_for_split_and_tight_to_dict',\n", + " '_data',\n", + " '_dir_additions',\n", + " '_dir_deletions',\n", + " '_dispatch_frame_op',\n", + " '_drop_axis',\n", + " '_drop_labels_or_levels',\n", + " '_ensure_valid_index',\n", + " '_find_valid_index',\n", + " '_flags',\n", + " '_from_arrays',\n", + " '_get_agg_axis',\n", + " '_get_axis',\n", + " '_get_axis_name',\n", + " '_get_axis_number',\n", + " '_get_axis_resolvers',\n", + " '_get_block_manager_axis',\n", + " '_get_bool_data',\n", + " '_get_cleaned_column_resolvers',\n", + " '_get_column_array',\n", + " '_get_index_resolvers',\n", + " '_get_item_cache',\n", + " '_get_label_or_level_values',\n", + " '_get_numeric_data',\n", + " '_get_value',\n", + " '_getitem_bool_array',\n", + " '_getitem_multilevel',\n", + " '_getitem_nocopy',\n", + " '_gotitem',\n", + " '_hidden_attrs',\n", + " '_indexed_same',\n", + " '_info_axis',\n", + " '_info_axis_name',\n", + " '_info_axis_number',\n", + " '_info_repr',\n", + " '_init_mgr',\n", + " '_inplace_method',\n", + " '_internal_names',\n", + " '_internal_names_set',\n", + " '_is_copy',\n", + " '_is_homogeneous_type',\n", + " '_is_label_or_level_reference',\n", + " '_is_label_reference',\n", + " '_is_level_reference',\n", + " '_is_mixed_type',\n", + " '_is_view',\n", + " '_iset_item',\n", + " '_iset_item_mgr',\n", + " '_iset_not_inplace',\n", + " '_item_cache',\n", + " '_iter_column_arrays',\n", + " '_ixs',\n", + " '_join_compat',\n", + " '_logical_func',\n", + " '_logical_method',\n", + " '_maybe_cache_changed',\n", + " '_maybe_update_cacher',\n", + " '_metadata',\n", + " '_mgr',\n", + " '_min_count_stat_function',\n", + " '_needs_reindex_multi',\n", + " '_protect_consolidate',\n", + " '_reduce',\n", + " '_reduce_axis1',\n", + " '_reindex_axes',\n", + " '_reindex_columns',\n", + " '_reindex_index',\n", + " '_reindex_multi',\n", + " '_reindex_with_indexers',\n", + " '_rename',\n", + " '_replace_columnwise',\n", + " '_repr_data_resource_',\n", + " '_repr_fits_horizontal_',\n", + " '_repr_fits_vertical_',\n", + " '_repr_html_',\n", + " '_repr_latex_',\n", + " '_reset_cache',\n", + " '_reset_cacher',\n", + " '_sanitize_column',\n", + " '_series',\n", + " '_set_axis',\n", + " '_set_axis_name',\n", + " '_set_axis_nocheck',\n", + " '_set_is_copy',\n", + " '_set_item',\n", + " '_set_item_frame_value',\n", + " '_set_item_mgr',\n", + " '_set_value',\n", + " '_setitem_array',\n", + " '_setitem_frame',\n", + " '_setitem_slice',\n", + " '_slice',\n", + " '_stat_axis',\n", + " '_stat_axis_name',\n", + " '_stat_axis_number',\n", + " '_stat_function',\n", + " '_stat_function_ddof',\n", + " '_take',\n", + " '_take_with_is_copy',\n", + " '_to_dict_of_blocks',\n", + " '_to_latex_via_styler',\n", + " '_typ',\n", + " '_update_inplace',\n", + " '_validate_dtype',\n", + " '_values',\n", + " '_where',\n", + " 'abs',\n", + " 'add',\n", + " 'add_prefix',\n", + " 'add_suffix',\n", + " 'agg',\n", + " 'aggregate',\n", + " 'align',\n", + " 'all',\n", + " 'any',\n", + " 'apply',\n", + " 'applymap',\n", + " 'asfreq',\n", + " 'asof',\n", + " 'assign',\n", + " 'astype',\n", + " 'at',\n", + " 'at_time',\n", + " 'attrs',\n", + " 'axes',\n", + " 'backfill',\n", + " 'between_time',\n", + " 'bfill',\n", + " 'bool',\n", + " 'boxplot',\n", + " 'clip',\n", + " 'columns',\n", + " 'combine',\n", + " 'combine_first',\n", + " 'compare',\n", + " 'convert_dtypes',\n", + " 'copy',\n", + " 'corr',\n", + " 'corrwith',\n", + " 'count',\n", + " 'cov',\n", + " 'cummax',\n", + " 'cummin',\n", + " 'cumprod',\n", + " 'cumsum',\n", + " 'describe',\n", + " 'diff',\n", + " 'div',\n", + " 'divide',\n", + " 'dot',\n", + " 'drop',\n", + " 'drop_duplicates',\n", + " 'droplevel',\n", + " 'dropna',\n", + " 'dtypes',\n", + " 'duplicated',\n", + " 'empty',\n", + " 'eq',\n", + " 'equals',\n", + " 'eval',\n", + " 'ewm',\n", + " 'expanding',\n", + " 'explode',\n", + " 'ffill',\n", + " 'fillna',\n", + " 'filter',\n", + " 'first',\n", + " 'first_valid_index',\n", + " 'flags',\n", + " 'floordiv',\n", + " 'from_dict',\n", + " 'from_records',\n", + " 'ge',\n", + " 'get',\n", + " 'groupby',\n", + " 'gt',\n", + " 'head',\n", + " 'hist',\n", + " 'iat',\n", + " 'idxmax',\n", + " 'idxmin',\n", + " 'iloc',\n", + " 'index',\n", + " 'infer_objects',\n", + " 'info',\n", + " 'insert',\n", + " 'interpolate',\n", + " 'isetitem',\n", + " 'isin',\n", + " 'isna',\n", + " 'isnull',\n", + " 'items',\n", + " 'iterrows',\n", + " 'itertuples',\n", + " 'join',\n", + " 'keys',\n", + " 'kurt',\n", + " 'kurtosis',\n", + " 'last',\n", + " 'last_valid_index',\n", + " 'le',\n", + " 'loc',\n", + " 'lt',\n", + " 'mask',\n", + " 'max',\n", + " 'mean',\n", + " 'median',\n", + " 'melt',\n", + " 'memory_usage',\n", + " 'merge',\n", + " 'min',\n", + " 'mod',\n", + " 'mode',\n", + " 'mul',\n", + " 'multiply',\n", + " 'ndim',\n", + " 'ne',\n", + " 'nlargest',\n", + " 'notna',\n", + " 'notnull',\n", + " 'nsmallest',\n", + " 'nunique',\n", + " 'pad',\n", + " 'pct_change',\n", + " 'pipe',\n", + " 'pivot',\n", + " 'pivot_table',\n", + " 'plot',\n", + " 'pop',\n", + " 'pow',\n", + " 'prod',\n", + " 'product',\n", + " 'quantile',\n", + " 'query',\n", + " 'radd',\n", + " 'rank',\n", + " 'rdiv',\n", + " 'reindex',\n", + " 'reindex_like',\n", + " 'rename',\n", + " 'rename_axis',\n", + " 'reorder_levels',\n", + " 'replace',\n", + " 'resample',\n", + " 'reset_index',\n", + " 'rfloordiv',\n", + " 'rmod',\n", + " 'rmul',\n", + " 'rolling',\n", + " 'round',\n", + " 'rpow',\n", + " 'rsub',\n", + " 'rtruediv',\n", + " 'sample',\n", + " 'select_dtypes',\n", + " 'sem',\n", + " 'set_axis',\n", + " 'set_flags',\n", + " 'set_geometry',\n", + " 'set_index',\n", + " 'shape',\n", + " 'shift',\n", + " 'size',\n", + " 'skew',\n", + " 'sort_index',\n", + " 'sort_values',\n", + " 'squeeze',\n", + " 'stack',\n", + " 'std',\n", + " 'style',\n", + " 'sub',\n", + " 'subtract',\n", + " 'sum',\n", + " 'swapaxes',\n", + " 'swaplevel',\n", + " 'tail',\n", + " 'take',\n", + " 'to_clipboard',\n", + " 'to_csv',\n", + " 'to_dict',\n", + " 'to_excel',\n", + " 'to_feather',\n", + " 'to_gbq',\n", + " 'to_hdf',\n", + " 'to_html',\n", + " 'to_json',\n", + " 'to_latex',\n", + " 'to_markdown',\n", + " 'to_numpy',\n", + " 'to_orc',\n", + " 'to_parquet',\n", + " 'to_period',\n", + " 'to_pickle',\n", + " 'to_records',\n", + " 'to_sql',\n", + " 'to_stata',\n", + " 'to_string',\n", + " 'to_timestamp',\n", + " 'to_xarray',\n", + " 'to_xml',\n", + " 'transform',\n", + " 'transpose',\n", + " 'truediv',\n", + " 'truncate',\n", + " 'tz_convert',\n", + " 'tz_localize',\n", + " 'unstack',\n", + " 'update',\n", + " 'value_counts',\n", + " 'values',\n", + " 'var',\n", + " 'where',\n", + " 'xs']" + ] + }, + "metadata": {}, + "execution_count": 41 + } + ], + "source": [ + "dir(sp)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "NUufnYU-8mX4" + }, + "source": [ + "The following table summarizes some built-in Pandas aggregations:\n", + "\n", + "| Aggregation | Description |\n", + "|--------------------------|---------------------------------|\n", + "| ``count()`` | Total number of items |\n", + "| ``nunique()`` | Number of distinct items\n", + "| ``mean()``, ``median()`` | Mean and median |\n", + "| ``min()``, ``max()`` | Minimum and maximum |\n", + "| ``std()``, ``var()`` | Standard deviation and variance |\n", + "| ``mad()`` | Mean absolute deviation |\n", + "| ``prod()`` | Product of all items |\n", + "| ``sum()`` | Sum of all items |\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ZpV-jgcddGZ_" + }, + "source": [ + "- Some statistics are computed from pairs of columns:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "VBaSjSmDdGaC", + "outputId": "d9b5f4e0-51ac-459b-fea8-bc8812a26bd2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " GOOG APPL AMZN\n", + "GOOG 55.248513 13.269122 13.454445\n", + "APPL 13.269122 3.488251 3.236487\n", + "AMZN 13.454445 3.236487 3.364861" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      GOOGAPPLAMZN
      GOOG55.24851313.26912213.454445
      APPL13.2691223.4882513.236487
      AMZN13.4544453.2364873.364861
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"sp\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"GOOG\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 24.18349209326099,\n \"min\": 13.269121918691017,\n \"max\": 55.24851276078893,\n \"num_unique_values\": 3,\n \"samples\": [\n 55.24851276078893,\n 13.269121918691017,\n 13.454444533302368\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"APPL\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5.721051535790905,\n \"min\": 3.236486896205,\n \"max\": 13.269121918691017,\n \"num_unique_values\": 3,\n \"samples\": [\n 13.269121918691017,\n 3.48825113303532,\n 3.236486896205\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"AMZN\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5.862633587955939,\n \"min\": 3.236486896205,\n \"max\": 13.454444533302368,\n \"num_unique_values\": 3,\n \"samples\": [\n 13.454444533302368,\n 3.236486896205,\n 3.364860926703335\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 42 + } + ], + "source": [ + "sp.cov(numeric_only=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "K2lEOOAW8mX5", + "outputId": "b0e15c51-1915-4cb9-e2da-e1c65d661f9f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " APPL AMZN\n", + "APPL 3.488251 3.236487\n", + "AMZN 3.236487 3.364861" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      APPLAMZN
      APPL3.4882513.236487
      AMZN3.2364873.364861
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"sp[['APPL', 'AMZN']]\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"APPL\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.17802419912297515,\n \"min\": 3.236486896205,\n \"max\": 3.48825113303532,\n \"num_unique_values\": 2,\n \"samples\": [\n 3.236486896205,\n 3.48825113303532\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"AMZN\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.09077414749362132,\n \"min\": 3.236486896205,\n \"max\": 3.364860926703335,\n \"num_unique_values\": 2,\n \"samples\": [\n 3.364860926703335,\n 3.236486896205\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 43 + } + ], + "source": [ + "sp[['APPL', 'AMZN']].cov()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xo3NLs1QdGaD" + }, + "source": [ + "- Some produce multiple summary statistics in one shot:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 300 + }, + "id": "bR30nxwSdGaE", + "outputId": "5dce12b4-bd69-4e0d-c724-e41a4dc12ad0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " GOOG APPL AMZN\n", + "count 4.000000 4.000000 4.000000\n", + "mean 533.425003 118.509924 421.550003\n", + "std 7.432934 1.867686 1.834356\n", + "min 524.219971 116.547424 419.100006\n", + "25% 529.154984 117.099819 420.667503\n", + "50% 534.350006 118.635792 422.029999\n", + "75% 538.620025 120.045897 422.912499\n", + "max 540.780029 120.220688 423.040009" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      GOOGAPPLAMZN
      count4.0000004.0000004.000000
      mean533.425003118.509924421.550003
      std7.4329341.8676861.834356
      min524.219971116.547424419.100006
      25%529.154984117.099819420.667503
      50%534.350006118.635792422.029999
      75%538.620025120.045897422.912499
      max540.780029120.220688423.040009
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"sp\",\n \"rows\": 8,\n \"fields\": [\n {\n \"column\": \"GOOG\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 244.33736825518412,\n \"min\": 4.0,\n \"max\": 540.780029,\n \"num_unique_values\": 8,\n \"samples\": [\n 533.4250030000001,\n 534.350006,\n 4.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"APPL\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 53.51923645373125,\n \"min\": 1.8676860370617223,\n \"max\": 120.220688,\n \"num_unique_values\": 8,\n \"samples\": [\n 118.50992400000001,\n 118.63579200000001,\n 4.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"AMZN\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 193.79429323398534,\n \"min\": 1.834355725235249,\n \"max\": 423.040009,\n \"num_unique_values\": 8,\n \"samples\": [\n 421.55000300000006,\n 422.02999850000003,\n 4.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 89 + } + ], + "source": [ + "# by default, summarize numeric columns only\n", + "sp.describe()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "The `include=['O']` means including only the columns with data type 'object' in the output of the describe() method. Here, 'O' stands for object, which typically pertains to strings or mixed data types in pandas." + ], + "metadata": { + "id": "SjBU1-g8HJuZ" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "YUv2dmLK8mX8", + "outputId": "e322454b-bf14-4122-c9ee-006f331043b6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date\n", + "count 4\n", + "unique 4\n", + "top 2015/5/1\n", + "freq 1" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Date
      count4
      unique4
      top2015/5/1
      freq1
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"sp\",\n \"rows\": 4,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"1970-01-01 00:00:00.000000001\",\n \"max\": \"2015-05-01 00:00:00\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"4\",\n \"2015/5/1\",\n \"1\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 90 + } + ], + "source": [ + "# Python object columns can be selected using include=['O'].\n", + "sp.describe(include=['O'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ztubCDQ-8mX9", + "outputId": "9a50f269-caad-49fb-8a63-7bac2c4fb7a8" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "RangeIndex: 4 entries, 0 to 3\n", + "Data columns (total 4 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Date 4 non-null object \n", + " 1 GOOG 4 non-null float64\n", + " 2 APPL 4 non-null float64\n", + " 3 AMZN 4 non-null float64\n", + "dtypes: float64(3), object(1)\n", + "memory usage: 256.0+ bytes\n" + ] + } + ], + "source": [ + "sp.info()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "mtZzbfB8gKQu" + }, + "source": [ + "`Series` objects' `value_counts()` method can return the frequency of distinct values it contains:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-8AcPogegr8y", + "outputId": "5f756067-11c9-4b06-9d15-cdfaf2afcde6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Date\n", + "2015/5/1 1\n", + "2015/5/4 1\n", + "2015/5/5 1\n", + "2015/5/6 1\n", + "Name: count, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 93 + } + ], + "source": [ + "sp['Date'].value_counts()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_SRhspgjrzdg" + }, + "source": [ + "*Excercise*:\n", + "Can you calculate the standard deviation of stocks in `sp`?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "aGddi9_HsACN", + "outputId": "29eb1e7c-7ff4-46a0-f83e-cdb2d16fbe9a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "GOOG 7.432934\n", + "APPL 1.867686\n", + "AMZN 1.834356\n", + "dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 94 + } + ], + "source": [ + "# write your code here\n", + "sp[['GOOG', 'APPL', 'AMZN']].std()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "LJMVU4nU8mW5" + }, + "source": [ + "---\n", + "\n", + "
      \n", + "\n", + "# 5 Handling Missing Values" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "PMCPChKl8mW5", + "outputId": "84d81f35-4918-4b20-9a23-99cdb3920089" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4\n", + "1 2.0 NaN 5\n", + "2 NaN NaN 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      12.0NaN5
      2NaNNaN6
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "df_w_nan", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7071067811865476,\n \"min\": 1.0,\n \"max\": 2.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 2.0,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 95 + } + ], + "source": [ + "import numpy as np\n", + "\n", + "df_w_nan = pd.DataFrame({'A': [1, 2, np.nan],\n", + " 'B': [5, np.nan, np.nan],\n", + " 'C': [4, 5, 6]})\n", + "df_w_nan" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WxrkQ2wKdGZH" + }, + "source": [ + "\n", + "Pandas provides several useful methods for detecting, removing, and replacing missing values in pandas data structures:\n", + "\n", + "- [`isnull()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isna.html) generates a boolean mask indicating missing values, while [`notnull()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.notna.html) produces the opposite:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "kYRcEYES8mW9", + "outputId": "0ce23f0a-1a21-4faf-d5fe-8d3cd5cca75d" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 False False False\n", + "1 False True False\n", + "2 True True False" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      0FalseFalseFalse
      1FalseTrueFalse
      2TrueTrueFalse
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 2,\n \"samples\": [\n true,\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 2,\n \"samples\": [\n true,\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"boolean\",\n \"num_unique_values\": 1,\n \"samples\": [\n false\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 96 + } + ], + "source": [ + "df_w_nan.isnull()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xkXQSA9K8mW_", + "outputId": "95289e32-344c-4f24-be16-e600b50e926f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0 True\n", + "1 True\n", + "2 False\n", + "Name: A, dtype: bool" + ] + }, + "metadata": {}, + "execution_count": 97 + } + ], + "source": [ + "df_w_nan.A.notnull()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JHC_6HHQ8mXB" + }, + "source": [ + "\n", + "- [`dropna()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dropna.html) returns a filtered version of the data:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 81 + }, + "id": "FpDN3MRx8mXC", + "outputId": "42add103-652f-4b08-e213-4c398dc2af3a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 1,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 1.0,\n \"max\": 1.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 4,\n \"max\": 4,\n \"num_unique_values\": 1,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 98 + } + ], + "source": [ + "df_w_nan.dropna(axis=0) # axis=0 Drop rows which contain missing values." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "H6_ulSI-8mXD", + "outputId": "467f88cf-36bf-484a-d8f3-74b32990793b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " C\n", + "0 4\n", + "1 5\n", + "2 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      C
      04
      15
      26
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4,\n 5,\n 6\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 99 + } + ], + "source": [ + "df_w_nan.dropna(axis=1) # axis=1 Drop columns which contain missing values." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yivKqJG-8mXG" + }, + "source": [ + "\n", + "- [`fillna()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.fillna.html) returns a copy of the data with missing values filled or imputed (set `inplace=True` to modify it in place):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "lmVV7bpl8mXI", + "outputId": "efbf5492-41f9-43c1-d24f-d4088ca1226b" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4\n", + "1 2.0 NaN 5\n", + "2 NaN NaN 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      12.0NaN5
      2NaNNaN6
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "df_w_nan", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7071067811865476,\n \"min\": 1.0,\n \"max\": 2.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 2.0,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": null,\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 100 + } + ], + "source": [ + "df_w_nan" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "YHN9QNRX8mXK", + "outputId": "1f7e1037-257f-44c4-f982-3f6d296a93f9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4\n", + "1 2.0 0.0 5\n", + "2 0.0 0.0 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      12.00.05
      20.00.06
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.0,\n \"min\": 0.0,\n \"max\": 2.0,\n \"num_unique_values\": 3,\n \"samples\": [\n 1.0,\n 2.0,\n 0.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2.8867513459481287,\n \"min\": 0.0,\n \"max\": 5.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 0.0,\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4,\n 5\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 102 + } + ], + "source": [ + "# Replace all NaN elements with 0s.\n", + "df_w_nan.fillna(0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "CPDbf5qv8mXL", + "outputId": "26f6ff4d-40c5-4f3b-ae0e-04f03eeabda2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4\n", + "1 2.0 5.0 5\n", + "2 2.0 5.0 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      12.05.05
      22.05.06
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.5773502691896257,\n \"min\": 1.0,\n \"max\": 2.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 2.0,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.0,\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 103 + } + ], + "source": [ + "#ffill() function is used to forward fill the missing value with the value from the previous row (column) when axis = 0 (1)\n", + "df_w_nan.fillna(method='ffill', axis=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lmZwc_wpt_pj" + }, + "source": [ + "A more flexible way to fill or impute values (in place) is to use the assignment form of indexing:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "y4WYqzg-mIjX", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "outputId": "825c1e82-6723-4e97-b1ef-dbdec91719cd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " A B C\n", + "0 1.0 5.0 4\n", + "1 2.0 5.0 5\n", + "2 NaN 5.0 6" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      ABC
      01.05.04
      12.05.05
      2NaN5.06
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "df_w_nan", + "summary": "{\n \"name\": \"df_w_nan\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"A\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7071067811865476,\n \"min\": 1.0,\n \"max\": 2.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 2.0,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"B\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.0,\n \"min\": 5.0,\n \"max\": 5.0,\n \"num_unique_values\": 1,\n \"samples\": [\n 5.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"C\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 4,\n \"max\": 6,\n \"num_unique_values\": 3,\n \"samples\": [\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 104 + } + ], + "source": [ + "df_w_nan.loc[df_w_nan.B.isnull(), 'B'] = df_w_nan.B.mean()\n", + "df_w_nan" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "62sWIkFldGap" + }, + "source": [ + "---\n", + "\n", + "
      \n", + "\n", + "# 6 Computing Group-wise Summary Statistics\n", + "\n", + "\n", + "\n", + "Categorizing a dataset and applying a function to each group (whether be an aggregation or transformation) is often a critical component of a data analysis workflow. \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "Splitting data in a `DataFrame` into groups can be done by calling the `DataFrame`'s [`groupby()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html) method, passing the name of the desired key column:\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 425 + }, + "id": "ji2znJdbdGa2", + "outputId": "b0adf8e6-c883-4797-f2f4-4c264ba84695" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date Symbol Price Volume\n", + "0 2015/5/1 GOOG 537.900024 1768200\n", + "1 2015/5/4 GOOG 540.780029 1308000\n", + "2 2015/5/5 GOOG 530.799988 1383100\n", + "3 2015/5/6 GOOG 524.219971 1567000\n", + "4 2015/5/1 APPL 120.220688 58512600\n", + "5 2015/5/4 APPL 119.987633 50988300\n", + "6 2015/5/5 APPL 117.283951 49271400\n", + "7 2015/5/6 APPL 116.547424 72141000\n", + "8 2015/5/1 AMZN 422.869995 3565800\n", + "9 2015/5/4 AMZN 423.040009 2270400\n", + "10 2015/5/5 AMZN 421.190002 2856400\n", + "11 2015/5/6 AMZN 419.100006 2552500" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DateSymbolPriceVolume
      02015/5/1GOOG537.9000241768200
      12015/5/4GOOG540.7800291308000
      22015/5/5GOOG530.7999881383100
      32015/5/6GOOG524.2199711567000
      42015/5/1APPL120.22068858512600
      52015/5/4APPL119.98763350988300
      62015/5/5APPL117.28395149271400
      72015/5/6APPL116.54742472141000
      82015/5/1AMZN422.8699953565800
      92015/5/4AMZN423.0400092270400
      102015/5/5AMZN421.1900022856400
      112015/5/6AMZN419.1000062552500
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "stock", + "summary": "{\n \"name\": \"stock\",\n \"rows\": 12,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 4,\n \"samples\": [\n \"2015/5/4\",\n \"2015/5/6\",\n \"2015/5/1\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Symbol\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"GOOG\",\n \"APPL\",\n \"AMZN\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 183.11895671451376,\n \"min\": 116.547424,\n \"max\": 540.780029,\n \"num_unique_values\": 12,\n \"samples\": [\n 421.190002,\n 423.040009,\n 537.900024\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Volume\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 27902924,\n \"min\": 1308000,\n \"max\": 72141000,\n \"num_unique_values\": 12,\n \"samples\": [\n 2856400,\n 2270400,\n 1768200\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 44 + } + ], + "source": [ + "#! wget -q -O stock.csv \"https://raw.githubusercontent.com/justinjiajia/datafiles/main/pricevolume_sub.csv\"\n", + "#stock = pd.read_csv(\"stock.csv\")\n", + "stock = pd.read_csv(\"https://raw.githubusercontent.com/justinjiajia/datafiles/main/pricevolume_sub.csv\")\n", + "stock" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "pu1SX3u8dGa4", + "outputId": "16880a51-126c-4d43-b8e2-dda3f0398a20" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "AMZN\n", + " Date Symbol Price Volume\n", + "8 2015/5/1 AMZN 422.869995 3565800\n", + "9 2015/5/4 AMZN 423.040009 2270400\n", + "10 2015/5/5 AMZN 421.190002 2856400\n", + "11 2015/5/6 AMZN 419.100006 2552500\n", + "APPL\n", + " Date Symbol Price Volume\n", + "4 2015/5/1 APPL 120.220688 58512600\n", + "5 2015/5/4 APPL 119.987633 50988300\n", + "6 2015/5/5 APPL 117.283951 49271400\n", + "7 2015/5/6 APPL 116.547424 72141000\n", + "GOOG\n", + " Date Symbol Price Volume\n", + "0 2015/5/1 GOOG 537.900024 1768200\n", + "1 2015/5/4 GOOG 540.780029 1308000\n", + "2 2015/5/5 GOOG 530.799988 1383100\n", + "3 2015/5/6 GOOG 524.219971 1567000\n" + ] + } + ], + "source": [ + "stock_by_symbol = stock.groupby('Symbol')\n", + "\n", + "# what was returned is a GroupBy object\n", + "# wrap it in a loop to have a peek at the resulting grouping\n", + "for key, group in stock_by_symbol:\n", + " print(key)\n", + " print(group)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "S335A83LdGa6", + "outputId": "3174bd76-8a29-4625-cebf-45d207043727" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "('2015/5/1', 'AMZN')\n", + " Date Symbol Price Volume\n", + "8 2015/5/1 AMZN 422.869995 3565800\n", + "('2015/5/1', 'APPL')\n", + " Date Symbol Price Volume\n", + "4 2015/5/1 APPL 120.220688 58512600\n", + "('2015/5/1', 'GOOG')\n", + " Date Symbol Price Volume\n", + "0 2015/5/1 GOOG 537.900024 1768200\n", + "('2015/5/4', 'AMZN')\n", + " Date Symbol Price Volume\n", + "9 2015/5/4 AMZN 423.040009 2270400\n", + "('2015/5/4', 'APPL')\n", + " Date Symbol Price Volume\n", + "5 2015/5/4 APPL 119.987633 50988300\n", + "('2015/5/4', 'GOOG')\n", + " Date Symbol Price Volume\n", + "1 2015/5/4 GOOG 540.780029 1308000\n", + "('2015/5/5', 'AMZN')\n", + " Date Symbol Price Volume\n", + "10 2015/5/5 AMZN 421.190002 2856400\n", + "('2015/5/5', 'APPL')\n", + " Date Symbol Price Volume\n", + "6 2015/5/5 APPL 117.283951 49271400\n", + "('2015/5/5', 'GOOG')\n", + " Date Symbol Price Volume\n", + "2 2015/5/5 GOOG 530.799988 1383100\n", + "('2015/5/6', 'AMZN')\n", + " Date Symbol Price Volume\n", + "11 2015/5/6 AMZN 419.100006 2552500\n", + "('2015/5/6', 'APPL')\n", + " Date Symbol Price Volume\n", + "7 2015/5/6 APPL 116.547424 72141000\n", + "('2015/5/6', 'GOOG')\n", + " Date Symbol Price Volume\n", + "3 2015/5/6 GOOG 524.219971 1567000\n" + ] + } + ], + "source": [ + "stock_by_date_symbol = stock.groupby(['Date', 'Symbol'])\n", + "\n", + "for key, group in stock_by_date_symbol:\n", + " print(key)\n", + " print(group)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WDwA2lHpdGbB" + }, + "source": [ + "\n", + "\n", + "Pandas provides [many common aggregations](https://pandas.pydata.org/pandas-docs/stable/reference/groupby.html#computations-descriptive-stats) that can be applied to `GroupBy` objects and return a scalar per group in the apply/combine steps:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "z_mfX9WLcPRu", + "outputId": "5460927b-8e65-41f9-e4a5-f0dd6957a7f3" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['Date',\n", + " 'Price',\n", + " 'Symbol',\n", + " 'Volume',\n", + " '_DataFrameGroupBy__examples_dataframe_doc',\n", + " '__annotations__',\n", + " '__class__',\n", + " '__class_getitem__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattr__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__orig_bases__',\n", + " '__parameters__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__slots__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " '__weakref__',\n", + " '_accessors',\n", + " '_agg_examples_doc',\n", + " '_agg_general',\n", + " '_agg_py_fallback',\n", + " '_aggregate_frame',\n", + " '_aggregate_with_numba',\n", + " '_apply_filter',\n", + " '_apply_to_column_groupbys',\n", + " '_ascending_count',\n", + " '_bool_agg',\n", + " '_cache',\n", + " '_choose_path',\n", + " '_concat_objects',\n", + " '_constructor',\n", + " '_cumcount_array',\n", + " '_cython_agg_general',\n", + " '_cython_transform',\n", + " '_define_paths',\n", + " '_descending_count',\n", + " '_dir_additions',\n", + " '_dir_deletions',\n", + " '_fill',\n", + " '_get_cythonized_result',\n", + " '_get_data_to_aggregate',\n", + " '_get_index',\n", + " '_get_indices',\n", + " '_gotitem',\n", + " '_hidden_attrs',\n", + " '_indexed_output_to_ndframe',\n", + " '_insert_inaxis_grouper',\n", + " '_internal_names',\n", + " '_internal_names_set',\n", + " '_is_protocol',\n", + " '_iterate_column_groupbys',\n", + " '_iterate_slices',\n", + " '_make_mask_from_int',\n", + " '_make_mask_from_list',\n", + " '_make_mask_from_positional_indexer',\n", + " '_make_mask_from_slice',\n", + " '_make_mask_from_tuple',\n", + " '_mask_selected_obj',\n", + " '_maybe_transpose_result',\n", + " '_nth',\n", + " '_numba_agg_general',\n", + " '_numba_prep',\n", + " '_obj_1d_constructor',\n", + " '_obj_with_exclusions',\n", + " '_op_via_apply',\n", + " '_positional_selector',\n", + " '_python_agg_general',\n", + " '_python_apply_general',\n", + " '_reindex_output',\n", + " '_reset_cache',\n", + " '_selected_obj',\n", + " '_selection',\n", + " '_selection_list',\n", + " '_set_result_index_ordered',\n", + " '_transform',\n", + " '_transform_general',\n", + " '_transform_with_numba',\n", + " '_value_counts',\n", + " '_wrap_agged_manager',\n", + " '_wrap_aggregated_output',\n", + " '_wrap_applied_output',\n", + " '_wrap_applied_output_series',\n", + " '_wrap_transform_fast_result',\n", + " 'agg',\n", + " 'aggregate',\n", + " 'all',\n", + " 'any',\n", + " 'apply',\n", + " 'bfill',\n", + " 'boxplot',\n", + " 'corr',\n", + " 'corrwith',\n", + " 'count',\n", + " 'cov',\n", + " 'cumcount',\n", + " 'cummax',\n", + " 'cummin',\n", + " 'cumprod',\n", + " 'cumsum',\n", + " 'describe',\n", + " 'diff',\n", + " 'dtypes',\n", + " 'ewm',\n", + " 'expanding',\n", + " 'ffill',\n", + " 'fillna',\n", + " 'filter',\n", + " 'first',\n", + " 'get_group',\n", + " 'groups',\n", + " 'head',\n", + " 'hist',\n", + " 'idxmax',\n", + " 'idxmin',\n", + " 'indices',\n", + " 'last',\n", + " 'max',\n", + " 'mean',\n", + " 'median',\n", + " 'min',\n", + " 'ndim',\n", + " 'ngroup',\n", + " 'ngroups',\n", + " 'nth',\n", + " 'nunique',\n", + " 'ohlc',\n", + " 'pct_change',\n", + " 'pipe',\n", + " 'plot',\n", + " 'prod',\n", + " 'quantile',\n", + " 'rank',\n", + " 'resample',\n", + " 'rolling',\n", + " 'sample',\n", + " 'sem',\n", + " 'shift',\n", + " 'size',\n", + " 'skew',\n", + " 'std',\n", + " 'sum',\n", + " 'tail',\n", + " 'take',\n", + " 'transform',\n", + " 'value_counts',\n", + " 'var']" + ] + }, + "metadata": {}, + "execution_count": 109 + } + ], + "source": [ + "dir(stock_by_symbol)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "eCB8zLYgdGbD", + "outputId": "d963268a-3340-42c2-9ef2-a2f7a83444df" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Price Volume\n", + "Symbol \n", + "AMZN 421.550003 2811275.0\n", + "APPL 118.509924 57728325.0\n", + "GOOG 533.425003 1506575.0" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      PriceVolume
      Symbol
      AMZN421.5500032811275.0
      APPL118.50992457728325.0
      GOOG533.4250031506575.0
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"stock_by_symbol\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Symbol\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"AMZN\",\n \"APPL\",\n \"GOOG\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 214.671775775214,\n \"min\": 118.509924,\n \"max\": 533.4250030000001,\n \"num_unique_values\": 3,\n \"samples\": [\n 421.550003,\n 118.509924,\n 533.4250030000001\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Volume\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 32089639.54262861,\n \"min\": 1506575.0,\n \"max\": 57728325.0,\n \"num_unique_values\": 3,\n \"samples\": [\n 2811275.0,\n 57728325.0,\n 1506575.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 110 + } + ], + "source": [ + "# can only apply to numeric columns\n", + "stock_by_symbol.mean(numeric_only=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "mfaA9Uyn0cI5", + "outputId": "ec274c92-0a2b-4c3d-ce4b-6f888a5221a9" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date Price Volume\n", + "Symbol \n", + "AMZN 2015/5/1 419.100006 2270400\n", + "APPL 2015/5/1 116.547424 49271400\n", + "GOOG 2015/5/1 524.219971 1308000" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DatePriceVolume
      Symbol
      AMZN2015/5/1419.1000062270400
      APPL2015/5/1116.54742449271400
      GOOG2015/5/1524.2199711308000
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"stock_by_symbol\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Symbol\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"AMZN\",\n \"APPL\",\n \"GOOG\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"2015/5/1\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 211.65426899149122,\n \"min\": 116.547424,\n \"max\": 524.219971,\n \"num_unique_values\": 3,\n \"samples\": [\n 419.100006\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Volume\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 27418083,\n \"min\": 1308000,\n \"max\": 49271400,\n \"num_unique_values\": 3,\n \"samples\": [\n 2270400\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 47 + } + ], + "source": [ + "# can also apply to categorical columns\n", + "stock_by_symbol.min()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 174 + }, + "id": "o3iyQqHJ0nD0", + "outputId": "8c11d8ae-faa1-4d42-f314-41b2eb8ff431" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Date Price Volume\n", + "Symbol \n", + "AMZN 2015/5/1 422.869995 3565800\n", + "APPL 2015/5/1 120.220688 58512600\n", + "GOOG 2015/5/1 537.900024 1768200" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      DatePriceVolume
      Symbol
      AMZN2015/5/1422.8699953565800
      APPL2015/5/1120.22068858512600
      GOOG2015/5/1537.9000241768200
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"stock_by_symbol\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Symbol\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"AMZN\",\n \"APPL\",\n \"GOOG\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"2015/5/1\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 215.74851807939186,\n \"min\": 120.220688,\n \"max\": 537.900024,\n \"num_unique_values\": 3,\n \"samples\": [\n 422.869995\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Volume\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 32254997,\n \"min\": 1768200,\n \"max\": 58512600,\n \"num_unique_values\": 3,\n \"samples\": [\n 3565800\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 48 + } + ], + "source": [ + "# select the first record of each group\n", + "stock_by_symbol.first()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Nz6Nb0-GdGbH" + }, + "source": [ + "To suppress using group keys as indices in the aggregated output, we can pass `as_index=False` to `groupby()` when first creating the `GroupBy` object:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 143 + }, + "id": "x5YRkPy2dGbH", + "outputId": "260fd0f6-079f-4357-d92e-7177d5b5bc7a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Symbol Price Volume\n", + "0 AMZN 421.550003 2811275.0\n", + "1 APPL 118.509924 57728325.0\n", + "2 GOOG 533.425003 1506575.0" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      SymbolPriceVolume
      0AMZN421.5500032811275.0
      1APPL118.50992457728325.0
      2GOOG533.4250031506575.0
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"stock_by_symbol\",\n \"rows\": 3,\n \"fields\": [\n {\n \"column\": \"Symbol\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 3,\n \"samples\": [\n \"AMZN\",\n \"APPL\",\n \"GOOG\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 214.671775775214,\n \"min\": 118.509924,\n \"max\": 533.4250030000001,\n \"num_unique_values\": 3,\n \"samples\": [\n 421.550003,\n 118.509924,\n 533.4250030000001\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Volume\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 32089639.54262861,\n \"min\": 1506575.0,\n \"max\": 57728325.0,\n \"num_unique_values\": 3,\n \"samples\": [\n 2811275.0,\n 57728325.0,\n 1506575.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 49 + } + ], + "source": [ + "stock_by_symbol = stock.groupby('Symbol', as_index=False)\n", + "stock_by_symbol.mean(numeric_only=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "pcMUIpx1s4BW" + }, + "source": [ + "*In-Class Exercise:*\n", + "\n", + "What is the most popular names for US babies?\n", + "\n", + "Below codes allows you to retrieve US baby names from 2004~2014, please apply what you have learnt to get the 5 most popular names during this period with the counts of each name? Hint: you may use `.sort_values(by=\"Column\", ascending=False)` method to sort a DataFrame." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + }, + "id": "2JIpEZY7tOgA", + "outputId": "1cf8a561-c172-4335-df7e-c933ed674983" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Unnamed: 0 Id Name Year Gender State Count\n", + "0 11349 11350 Emma 2004 F AK 62\n", + "1 11350 11351 Madison 2004 F AK 48\n", + "2 11351 11352 Hannah 2004 F AK 46\n", + "3 11352 11353 Grace 2004 F AK 44\n", + "4 11353 11354 Emily 2004 F AK 41\n", + "... ... ... ... ... ... ... ...\n", + "1016390 5647421 5647422 Seth 2014 M WY 5\n", + "1016391 5647422 5647423 Spencer 2014 M WY 5\n", + "1016392 5647423 5647424 Tyce 2014 M WY 5\n", + "1016393 5647424 5647425 Victor 2014 M WY 5\n", + "1016394 5647425 5647426 Waylon 2014 M WY 5\n", + "\n", + "[1016395 rows x 7 columns]" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Unnamed: 0IdNameYearGenderStateCount
      01134911350Emma2004FAK62
      11135011351Madison2004FAK48
      21135111352Hannah2004FAK46
      31135211353Grace2004FAK44
      41135311354Emily2004FAK41
      ........................
      101639056474215647422Seth2014MWY5
      101639156474225647423Spencer2014MWY5
      101639256474235647424Tyce2014MWY5
      101639356474245647425Victor2014MWY5
      101639456474255647426Waylon2014MWY5
      \n", + "

      1016395 rows × 7 columns

      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "baby_names" + } + }, + "metadata": {}, + "execution_count": 3 + } + ], + "source": [ + "baby_names = pd.read_csv('https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/US_Baby_Names/US_Baby_Names_right.csv')\n", + "baby_names" + ] + }, + { + "cell_type": "code", + "source": [ + "#write your code here\n", + "group_baby_names = baby_names.groupby('Name')" + ], + "metadata": { + "id": "Xrp2SCEqLKlV" + }, + "execution_count": 4, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "group_baby_names.sum(numeric_only=True).sort_values(by=\"Count\", ascending=False).iloc[:5,[3]]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 237 + }, + "id": "KaSgCPzQxn6A", + "outputId": "514866e6-4e89-444e-f2d0-1a3c022ddf88" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Count\n", + "Name \n", + "Jacob 242874\n", + "Emma 214852\n", + "Michael 214405\n", + "Ethan 209277\n", + "Isabella 204798" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Count
      Name
      Jacob242874
      Emma214852
      Michael214405
      Ethan209277
      Isabella204798
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"group_baby_names\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"Emma\",\n \"Isabella\",\n \"Michael\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Count\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 14908,\n \"min\": 204798,\n \"max\": 242874,\n \"num_unique_values\": 5,\n \"samples\": [\n 214852,\n 204798,\n 214405\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "eQAMrXLnRNhp" + }, + "source": [ + "*Additional*: What are the 5 most popular male/female baby names?" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "id": "MIOHSZeOWKk4" + }, + "outputs": [], + "source": [ + "# write your code here\n", + "group_gender_baby_names = baby_names.groupby(['Gender','Name'])" + ] + }, + { + "cell_type": "code", + "source": [ + "name_count_gender = group_gender_baby_names.sum(numeric_only=True)" + ], + "metadata": { + "id": "w2fTmNoTyn_y" + }, + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "name_count_gender.loc['F'].sort_values(by=\"Count\", ascending=False).iloc[:5,[3]]" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 237 + }, + "id": "BH5bYXiEyxY1", + "outputId": "3b4606c0-e456-4abf-a517-7854a8650d8a" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Count\n", + "Name \n", + "Emma 214757\n", + "Isabella 204742\n", + "Sophia 191421\n", + "Emily 190211\n", + "Olivia 187962" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Count
      Name
      Emma214757
      Isabella204742
      Sophia191421
      Emily190211
      Olivia187962
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"name_count_gender\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"Isabella\",\n \"Olivia\",\n \"Sophia\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Count\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 11519,\n \"min\": 187962,\n \"max\": 214757,\n \"num_unique_values\": 5,\n \"samples\": [\n 204742,\n 187962,\n 191421\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "name_count_gender.loc['M'].sort_values(by=\"Count\", ascending=False).iloc[:5,[3]]" + ], + "metadata": { + "id": "OuRPQAHhzToK", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 237 + }, + "outputId": "5408c993-afb9-4841-cf44-562b2bcfd146" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Count\n", + "Name \n", + "Jacob 242706\n", + "Michael 214228\n", + "Ethan 209153\n", + "William 197796\n", + "Joshua 191444" + ], + "text/html": [ + "\n", + "
      \n", + "
      \n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      Count
      Name
      Jacob242706
      Michael214228
      Ethan209153
      William197796
      Joshua191444
      \n", + "
      \n", + "
      \n", + "\n", + "
      \n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
      \n", + "\n", + "\n", + "
      \n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
      \n", + "
      \n", + "
      \n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"name_count_gender\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"Michael\",\n \"Joshua\",\n \"Ethan\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Count\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 19848,\n \"min\": 191444,\n \"max\": 242706,\n \"num_unique_values\": 5,\n \"samples\": [\n 214228,\n 191444,\n 209153\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 11 + } + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "hide_input": false, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/course_materials/lab8_selenium_ans.ipynb b/course_materials/lab8_selenium_ans.ipynb new file mode 100644 index 0000000..e458451 --- /dev/null +++ b/course_materials/lab8_selenium_ans.ipynb @@ -0,0 +1,376 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Lab 8: Selenium " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Through this lab exercise, we aim to provide hints for Assignment 1. While the task is not identical to the assignment, it serves as a helpful guide to facilitate a smooth start for you. Follow the instructions and complete the tasks.\n", + "\n", + "#### Task 1.1\n", + "Launch the ChromeDriver, drive the ChromeDriver to open the website of CNN Election 2024, access to one of the states, Alabama directly. \n", + "(i.e. 'https://edition.cnn.com/election/2024/primaries-and-caucuses/results/alabama') " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "# Import packages\n", + "from selenium import webdriver\n", + "from selenium.webdriver.chrome.service import Service\n", + "from webdriver_manager.chrome import ChromeDriverManager\n", + "from selenium.webdriver.common.by import By\n", + "from selenium.webdriver.common.keys import Keys\n", + "\n", + "from bs4 import BeautifulSoup\n", + "import pandas as pd\n", + "\n", + "# Create driver object and get to imdb homepage\n", + "s = Service(ChromeDriverManager().install())\n", + "driver = webdriver.Chrome(service=s)\n", + "\n", + "# complete the code below\n", + "driver.get(\"https://edition.cnn.com/election/2024/primaries-and-caucuses/results/alabama\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Maximize the browser window to ensure that the web page is displayed in its optimal layout and dimensions." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# complete the code below\n", + "driver.maximize_window()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Get the current page title." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Alabama Democratic and Republican primary election results and maps 2024 | CNN Politics'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# complete the code below\n", + "driver.title" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Retrieve the HTML source code of the current web page." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'\\n\\n\\n \\n \\n \\n\\n \\n \\n Alabama Democratic and Republican primary election results and maps 2024 | CNN Politics\\n\\n\\n\\n \\n\\n\\n\\n\\n \\n \\n \\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n\\n \\n\\n\\n\\n \\n \\n \\n\\n \\n\\n\\n \\n\\n\\n\\n\\n\\n \\n \\n \\n \\n \\n\\n \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n\\n\\n\\n\\n\\n \\n\\n\\n \\n\\n
      \\n
      \\n
      \\n
      \\n

      CNN values your feedback

      \\n
      \\n
      \\n
      \\n
      \\n 1. How relevant is this ad to you?\\n
      \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n 2. Did you encounter any technical issues?\\n
      \\n
      \\n \\n No\\n
      \\n
      \\n\\n
      \\n
      \\n \\n \\n \\n \\n \\n \\n
      \\n
      \\n \\n \\n \\n \\n \\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n \\n \\n
      \\n
      \\n
      \\n\\n \\n
      \\n
      \\n\\n \\n \\n \\n \\n\\n \\n\\n \\n \\n
      \\n
      \\n
      \\n
      \\n
      \\n
      \\n

      CNN values your feedback

      \\n
      \\n
      \\n
      \\n
      \\n 1. How relevant is this ad to you?\\n
      \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n 2. Did you encounter any technical issues?\\n
      \\n
      \\n \\n \\n
      \\n
      \\n\\n
      \\n
      \\n \\n \\n \\n \\n \\n \\n
      \\n
      \\n \\n \\n \\n \\n \\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n \\n \\n
      \\n
      \\n
      \\n\\n \\n
      \\n
      \\n\\n
      \\n
      \\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n
      \\n\\n \\n\\n
      \\n
      \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n \"map-brand.png\"\\n
      \\n
      \\n
      \\n \\n

      \\n Presidential and Congressional Primaries: Alabama Results 2024\\n

      \\n
      \\n
      Results from the 2024 Alabama presidential and congressional primaries.
      \\n
      \\n
      \\n
      Results from the 2024 Alabama presidential and congressional primaries.
      \\n
      \\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n
      \\n
      \\n
      \\n

      \\n Our coverage of Alabama\\n

      \\n\\n
      \\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nMontgomery\\\\n\\\\nBirmingham\\\\n\\\\nMobile\\\\n\\\\n","__fields":{"status":"active-updated","created_at":"Tue, 05 Mar 2024 13:07:27 GMT","updated_at":"Wed, 27 Mar 2024 16:38:03 GMT"},"raceType":"PD","mapFeedURL":"https://politics.api.cnn.io/results/county-races/2024-PD-AL.json","variations":["--lastnames-in-legend"],"zoomOnLoad":false,"zoomOnClick":false,"zoomToGeoID":null,"componentKey":"2024primaries-PD-AL-*-ResultsSuite","resultForCRM":{"result":{"ahead":"","title":"President: Alabama","status":"","winner":{"id":1036,"party":"dem","winner":"","voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","incumbent":true,"partyName":"Democratic","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false},"isSwitch":"","isKeyRace":false,"candidates":[{"id":1036,"party":"dem","winner":"","voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","incumbent":true,"partyName":"Democratic","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false},{"id":100004,"party":"dem","winner":"","voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","incumbent":false,"partyName":"Democratic","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false},{"id":20286,"party":"dem","winner":"","voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","incumbent":false,"partyName":"Democratic","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false}],"isCountyRace":false,"electoralVotes":"","showAheadCount":true,"isBallotMeasure":false,"keyRaceFlagText":"Key Race","jurisdictionCode":0,"winnerBopPartyId":"DEM","droppedOutFlagText":"DROPPED OUT","percentReportingStr":"","lastUpdatedTimestamp":"","showUpdatedTimestamp":true,"totalDelegatesAtStake":"52"},"houseDistricts":[]},"rightButtons":[{"href":"/election/2024/primaries-and-caucuses/results/alabama/democratic-presidential-primary","label":"See county-level results"}],"resultsForMap":[{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Autauga","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:05.000Z","countyFipsCode":"01001","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Baldwin","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01003","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Barbour","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:57.000Z","countyFipsCode":"01005","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Bibb","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01007","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Blount","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01009","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Bullock","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:31:29.000Z","countyFipsCode":"01011","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Butler","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:26.000Z","countyFipsCode":"01013","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Calhoun","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01015","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Chambers","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01017","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Cherokee","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:30:52.000Z","countyFipsCode":"01019","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Chilton","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01021","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Choctaw","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:57:21.000Z","countyFipsCode":"01023","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Clarke","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:56:13.000Z","countyFipsCode":"01025","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Clay","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:20.000Z","countyFipsCode":"01027","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Cleburne","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:08:51.000Z","countyFipsCode":"01029","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Coffee","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01031","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Colbert","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01033","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Conecuh","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:04.000Z","countyFipsCode":"01035","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Coosa","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:30:53.000Z","countyFipsCode":"01037","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Covington","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01039","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Crenshaw","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:41:27.000Z","countyFipsCode":"01041","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Cullman","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01043","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Dale","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:59:39.000Z","countyFipsCode":"01045","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Dallas","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:51:02.000Z","countyFipsCode":"01047","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"DeKalb","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01049","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Elmore","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01051","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Escambia","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:31:34.000Z","countyFipsCode":"01053","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Etowah","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01055","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Fayette","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:44:49.000Z","countyFipsCode":"01057","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Franklin","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T05:20:44.000Z","countyFipsCode":"01059","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Geneva","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T02:57:18.000Z","countyFipsCode":"01061","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Greene","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:46:14.000Z","countyFipsCode":"01063","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Hale","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:22.000Z","countyFipsCode":"01065","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Henry","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01067","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Houston","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01069","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Jackson","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:43:42.000Z","countyFipsCode":"01071","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Jefferson","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:38.000Z","countyFipsCode":"01073","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Lamar","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:34:49.000Z","countyFipsCode":"01075","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Lauderdale","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01077","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Lawrence","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:59:39.000Z","countyFipsCode":"01079","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Lee","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01081","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Limestone","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01083","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Lowndes","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:57:07.000Z","countyFipsCode":"01085","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Macon","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:50:35.000Z","countyFipsCode":"01087","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Madison","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01089","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Marengo","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:45:31.000Z","countyFipsCode":"01091","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Marion","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T02:51:42.000Z","countyFipsCode":"01093","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Marshall","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:33:44.000Z","countyFipsCode":"01095","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Mobile","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:44.000Z","countyFipsCode":"01097","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Monroe","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:14.000Z","countyFipsCode":"01099","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Montgomery","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:53:22.000Z","countyFipsCode":"01101","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Morgan","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01103","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Perry","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:56:52.000Z","countyFipsCode":"01105","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Pickens","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:53:59.000Z","countyFipsCode":"01107","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Pike","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:42:17.000Z","countyFipsCode":"01109","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Randolph","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T02:24:58.000Z","countyFipsCode":"01111","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Russell","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:56.000Z","countyFipsCode":"01113","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Shelby","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01117","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"St. Clair","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01115","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Sumter","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:40:47.000Z","countyFipsCode":"01119","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Talladega","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:57.000Z","countyFipsCode":"01121","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Tallapoosa","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01123","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Tuscaloosa","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:38:02.000Z","countyFipsCode":"01125","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Walker","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:59:39.000Z","countyFipsCode":"01127","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Washington","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01129","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Wilcox","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:58.000Z","countyFipsCode":"01131","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PD-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Joe Biden","lastName":"Biden","firstName":"Joe","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":1036,"isIncumbent":true,"lastNameSlug":"biden","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Uncommitted","lastName":"Uncommitted","firstName":"","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":100004,"isIncumbent":false,"lastNameSlug":"uncommitted","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"},{"voteNum":"","voteStr":"","fullName":"Dean Phillips","lastName":"Phillips","firstName":"Dean","partyName":"Democratic","majorParty":"DEM","middleName":"","candidateId":20286,"isIncumbent":false,"lastNameSlug":"phillips","votePercentNum":"","votePercentStr":"","candidatePartyCode":"D"}],"countyName":"Winston","contestType":"PD","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"D","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:59:42.000Z","countyFipsCode":"01133","percentReporting":"","stateAbbreviation":"AL"}],"featureFlagURL":"https://politics-static.cnn.io/2021/feature-flags/2024primaries.json","suppressColorsUntilConfig":true,"componentVariation":"politics-results-suite"}\" data-key=\"2024primaries-PD-AL-*-ResultsSuite\">

      Democratic Presidential Primary: Alabama

      52
      Pledged Delegates
      Candidate % Votes Pledged Delegates Del.
      Joe Biden Democratic, Incumbent 89.5%
      168,080 156,797 ahead
      52
      Uncommitted Democratic 6.0%
      11,283 156,797 ahead
      Dean Phillips Democratic 4.5%
      8,442 156,797 ahead
      Projected Winner
      \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nMontgomery\\n\\nBirmingham\\n\\nMobile\\n\\n
      Leading
      Biden

      Est. vote in: 99%

      Checking for updates in: 08 seconds

      \\n
      \\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nMontgomery\\\\n\\\\nBirmingham\\\\n\\\\nMobile\\\\n\\\\n","__fields":{"status":"active-updated","created_at":"Tue, 05 Mar 2024 13:07:27 GMT","updated_at":"Wed, 27 Mar 2024 16:38:03 GMT"},"raceType":"PR","mapFeedURL":"https://politics.api.cnn.io/results/county-races/2024-PR-AL.json","variations":["--lastnames-in-legend"],"zoomOnLoad":false,"zoomOnClick":false,"zoomToGeoID":null,"componentKey":"2024primaries-PR-AL-*-ResultsSuite","resultForCRM":{"result":{"ahead":"","title":"President: Alabama","status":"","winner":{"id":8639,"party":"rep","winner":"","voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","incumbent":false,"partyName":"Republican","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false},"isSwitch":"","isKeyRace":true,"candidates":[{"id":8639,"party":"rep","winner":"","voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","incumbent":false,"partyName":"Republican","votePercent":"","isDroppedOut":false,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false},{"id":60420,"party":"rep","winner":"","voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","incumbent":false,"partyName":"Republican","votePercent":"","isDroppedOut":true,"electoralVotes":"","totalDelegates":"","votePercentStr":"","regularDelegates":"","isRunoffCandidate":false}],"isCountyRace":false,"electoralVotes":"","showAheadCount":true,"isBallotMeasure":false,"keyRaceFlagText":"Key Race","jurisdictionCode":0,"winnerBopPartyId":"REP","droppedOutFlagText":"DROPPED OUT","percentReportingStr":"","lastUpdatedTimestamp":"","showUpdatedTimestamp":true,"totalDelegatesAtStake":"50"},"houseDistricts":[]},"rightButtons":[{"href":"/election/2024/primaries-and-caucuses/results/alabama/republican-presidential-primary","label":"See county-level results"}],"resultsForMap":[{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Autauga","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:08:39.000Z","countyFipsCode":"01001","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Baldwin","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:44:37.000Z","countyFipsCode":"01003","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Barbour","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:56:59.000Z","countyFipsCode":"01005","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Bibb","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:39.000Z","countyFipsCode":"01007","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Blount","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:18.000Z","countyFipsCode":"01009","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Bullock","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:32:49.000Z","countyFipsCode":"01011","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Butler","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01013","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Calhoun","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:23.000Z","countyFipsCode":"01015","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Chambers","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:40:41.000Z","countyFipsCode":"01017","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Cherokee","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01019","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Chilton","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:27.000Z","countyFipsCode":"01021","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Choctaw","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:44.000Z","countyFipsCode":"01023","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Clarke","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:40:49.000Z","countyFipsCode":"01025","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Clay","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:42:43.000Z","countyFipsCode":"01027","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Cleburne","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:53:49.000Z","countyFipsCode":"01029","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Coffee","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01031","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Colbert","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01033","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Conecuh","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:55:32.000Z","countyFipsCode":"01035","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Coosa","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:30:53.000Z","countyFipsCode":"01037","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Covington","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:53:42.000Z","countyFipsCode":"01039","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Crenshaw","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T03:32:44.000Z","countyFipsCode":"01041","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Cullman","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01043","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Dale","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:03.000Z","countyFipsCode":"01045","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Dallas","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:25:44.000Z","countyFipsCode":"01047","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"DeKalb","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01049","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Elmore","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01051","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Escambia","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:12.000Z","countyFipsCode":"01053","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Etowah","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:38:00.000Z","countyFipsCode":"01055","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Fayette","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01057","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Franklin","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:44:51.000Z","countyFipsCode":"01059","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Geneva","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:52:24.000Z","countyFipsCode":"01061","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Greene","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01063","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Hale","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:59:38.000Z","countyFipsCode":"01065","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Henry","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:50:20.000Z","countyFipsCode":"01067","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Houston","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:38.000Z","countyFipsCode":"01069","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Jackson","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01071","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Jefferson","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:50:52.000Z","countyFipsCode":"01073","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Lamar","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:52:42.000Z","countyFipsCode":"01075","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Lauderdale","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01077","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Lawrence","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01079","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Lee","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01081","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Limestone","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01083","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Lowndes","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:00:51.000Z","countyFipsCode":"01085","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Macon","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:52.000Z","countyFipsCode":"01087","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Madison","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:47:48.000Z","countyFipsCode":"01089","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Marengo","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:52:50.000Z","countyFipsCode":"01091","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Marion","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:53:28.000Z","countyFipsCode":"01093","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Marshall","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01095","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Mobile","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:31.000Z","countyFipsCode":"01097","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Monroe","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:41:11.000Z","countyFipsCode":"01099","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Montgomery","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:56:24.000Z","countyFipsCode":"01101","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Morgan","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01103","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Perry","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01105","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Pickens","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:59.000Z","countyFipsCode":"01107","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Pike","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01109","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Randolph","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:42:01.000Z","countyFipsCode":"01111","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Russell","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:54:33.000Z","countyFipsCode":"01113","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Shelby","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:52:56.000Z","countyFipsCode":"01117","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"St. Clair","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01115","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Sumter","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-06T04:48:21.000Z","countyFipsCode":"01119","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Talladega","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01121","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Tallapoosa","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01123","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Tuscaloosa","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:56:43.000Z","countyFipsCode":"01125","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Walker","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01127","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Washington","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:37:58.000Z","countyFipsCode":"01129","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Wilcox","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:52:36.000Z","countyFipsCode":"01131","percentReporting":"","stateAbbreviation":"AL"},{"cid":"ESS::CountyRace::1711557344296","ecKey":"2024-PR-AL","stateId":1,"version":1,"raceType":"P","stateName":"Alabama","candidates":[{"voteNum":"","voteStr":"","fullName":"Donald Trump","lastName":"Trump","firstName":"Donald","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":8639,"isIncumbent":false,"lastNameSlug":"trump","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"},{"voteNum":"","voteStr":"","fullName":"Nikki Haley","lastName":"Haley","firstName":"Nikki","partyName":"Republican","majorParty":"REP","middleName":"","candidateId":60420,"isIncumbent":false,"lastNameSlug":"haley","votePercentNum":"","votePercentStr":"","candidatePartyCode":"R"}],"countyName":"Winston","contestType":"PR","externalKey":"production-key","extractedAt":"2024-03-27T16:35:44.425480","electionType":"R","raceTypeCode":"P","resourceType":"county-races","stateFipsCode":"01","voteTimestamp":"2024-03-25T16:49:04.000Z","countyFipsCode":"01133","percentReporting":"","stateAbbreviation":"AL"}],"featureFlagURL":"https://politics-static.cnn.io/2021/feature-flags/2024primaries.json","suppressColorsUntilConfig":true,"componentVariation":"politics-results-suite"}\" data-key=\"2024primaries-PR-AL-*-ResultsSuite\">

      Republican Presidential Primary: Alabama

      • Key Race
      50
      Bound Delegates
      Candidate % Votes Bound Delegates Del.
      Donald Trump Republican 83.2%
      499,147 421,158 ahead
      50
      Nikki Haley Republican 13.0%
      77,989 421,158 ahead
      0
      Projected Winner
      \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nMontgomery\\n\\nBirmingham\\n\\nMobile\\n\\n
      Leading
      Trump

      Est. vote in: 92%

      Checking for updates in: 08 seconds

      \\n
      \\n
      \\n
      \\n\\n\\n\\n
      \\n
      \\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n
      \\n\\n

      Democratic House Districts: Alabama

      Click the House district name for the full results.

      District Leading candidate(s) % Votes
      AL 1 Holmes 0.0%
      0
      AL 2 Figures
      43.5%
      24,825 12,051 ahead
      Daniels
      22.4%
      12,774
      AL 6 Anderson 0.0%
      0
      AL 7 Sewell Incumbent 92.6%
      59,040 54,331 ahead
      Davis 7.4%
      4,709
      \\n

      Republican House Districts: Alabama

      Click the House district name for the full results.

      District Leading candidate(s) % Votes
      AL 1
      Key Race
      Moore Incumbent 57.7%
      53,956 14,462 ahead
      Carl Incumbent 42.3%
      39,494
      AL 2 Brewbaker
      37.0%
      22,589 7,487 ahead
      Dobson
      24.8%
      15,102
      AL 3 Rogers Incumbent 81.9%
      71,242 60,316 ahead
      Newell 12.5%
      10,926
      AL 4 Aderholt Incumbent 79.7%
      88,976 66,295 ahead
      Holcomb 20.3%
      22,681
      AL 5 Strong Incumbent 0.0%
      0
      AL 6 Palmer Incumbent 83.2%
      76,488 66,787 ahead
      Wilkins 10.6%
      9,701
      AL 7 Horn 58.2%
      18,100 5,110 ahead
      Litaker 41.8%
      12,990
      \\n
      \\n
      \\n\\n
      \\n
      \\n\\n\\n
      \\n
      \\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n
      \\n\\n

      \\n Presidential primary and caucus winners\\n

      \\n\\n
      \\n
      \\n\\n
      \\n
      \\n\\n\\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n
      \\n \\n
      \\n\\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n
      \\n
      \\n

      Presidential primary and caucus winners in 2024

      \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n
      Haley
      Trump
      \\n \\n\\n\\n\\n\\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n\\n

      \\n Biden and Trump clinch their parties’ nominations for president\\n

      \\n\\n

      \\n President Joe Biden and former President Donald Trump have earned enough delegates to win their parties’ presidential nominations and are headed for a November rematch.\\n

      \\n\\n
      \\n
      \\n
      \\n

      Republican bound delegates

      Candidate 1,215 to win (out of 2,429) Bound Delegates
      Donald Trump
      1,863 1,772 ahead
      Nikki Haley DROPPED OUT
      91
      Ron DeSantis DROPPED OUT
      9
      Vivek Ramaswamy DROPPED OUT
      3

      Projected Winner

      Checking for updates in: 08 seconds

      \\n

      Democratic pledged delegates

      Candidate 1,968 to win (out of 3,934) Pledged Delegates
      Joe Biden
      3,057 3,031 ahead
      Uncommitted
      26
      Jason Palmer
      3
      Projected Winner

      Checking for updates in: 08 seconds

      \\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n

      \\n CNN Election Center features\\n

      \\n \\n
      \\n \\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n
      \\n \\n\\n\\n\\n\\n \\n\\n\\n\\n\\n \\n\\n\\n\\n\\n
      \\n
      \\n \\n
      \\n
      \\n
      \\n\\n \\n\\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n\\n
      \\n \\n
      \\n\\n
      \\n
      \\n \\n
      \\n\\n\\n
      \\n
      \\n
      \\n\\n
      \\n
      \\n
      \\n \\n\\n\\n'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# complete the code below\n", + "driver.page_source" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 1.2\n", + "Locate the 1st dropdown menu, scrape the U.S. states and territories list." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Alaska', 'Alabama', 'American Samoa', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Democrats Abroad', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Iowa', 'Kansas', 'Louisiana', 'Maine', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Nevada', 'New Hampshire', 'New York', 'North Carolina', 'North Dakota', 'Northern Mariana Islands', 'Ohio', 'Oklahoma', 'Rhode Island', 'South Carolina', 'Tennessee', 'Texas', 'US Virgin Islands', 'Utah', 'Vermont', 'Virginia', 'Washington', 'Wisconsin', 'Wyoming']\n" + ] + } + ], + "source": [ + "# complete the code below\n", + "\n", + "# scrap the states and territories list from the dropdown menu\n", + "dropdown_name = \"select\"\n", + "us_state = driver.find_element(By.NAME, dropdown_name).text.split('\\n')[1:]\n", + "#us_state = driver.find_element(\"name\", dropdown_name).text.split('\\n')[1:]\n", + "\n", + "# Lab Submission: What is the css selector for the dropdown menu? \n", + "dropdown_css = \"select#pol-dropdown\"\n", + "dropdown_menu = driver.find_element(By.CSS_SELECTOR, dropdown_css)\n", + "dropdown_menu.click()\n", + "\n", + "# store the states and territories names in a list\n", + "us_state = [state for state in us_state] \n", + "print(us_state)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 1.3\n", + "Locate and click the button - \"See county level results\"." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "# complete the code below\n", + "\n", + "# Locate the button - \"See county level results\"\n", + "county_button = driver.find_element(By.CLASS_NAME, \"cta-wrapper-1KjYeR\").find_element(By.TAG_NAME, \"a\")\n", + "#county_button = driver.find_element(\"class name\", \"cta-wrapper-1KjYeR\").find_element(\"tag name\", \"a\")\n", + "county_button.click()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 2.1\n", + "Scrape the winner's name and the number of delegates obtained in the Democratic presidential primary in Alabama.\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('Joe Biden', '52')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# complete the code below\n", + "\n", + "# Scrap the winner's name and number of delegates\n", + "winner_info = driver.find_element(By.CSS_SELECTOR, \"tr.isWinner-3g_AYM\").text.split(\"\\n\")\n", + "#winner_info = driver.find_element(\"css selector\", \"tr.isWinner-3g_AYM\").text.split(\"\\n\")\n", + "winner_info[0], winner_info[-1]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 2.2\n", + "You can find the tables showing election results for each county. That is the data we should extract. Pass the page source to BeautifulSoup HTML parser. With BeautifulSoup methods, scrape and print the county names." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Autauga\n", + "Baldwin\n", + "Barbour\n" + ] + } + ], + "source": [ + "# complete the code below\n", + "\n", + "soup = BeautifulSoup(driver.page_source, 'html.parser')\n", + "county_ls = soup.select('article.core-result div.header-container-1LzJY9 h2')\n", + "for county in county_ls:\n", + " print(county.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 2.3\n", + "Locate the 'Right arrow' button, write code to keep clicking on this button until it is not shown. Combine with the code in previous task and modify a bit, store all the county names in a list `county_ls`. \n", + "\n", + "Hints: implement with while-loop and try/except clause." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "done\n", + "\n", + "Total # of counties: 67\n", + "['Autauga', 'Baldwin', 'Barbour', 'Bibb', 'Blount', 'Bullock', 'Butler', 'Calhoun', 'Chambers', 'Cherokee', 'Chilton', 'Choctaw', 'Clarke', 'Clay', 'Cleburne', 'Coffee', 'Colbert', 'Conecuh', 'Coosa', 'Covington', 'Crenshaw', 'Cullman', 'Dale', 'Dallas', 'DeKalb', 'Elmore', 'Escambia', 'Etowah', 'Fayette', 'Franklin', 'Geneva', 'Greene', 'Hale', 'Henry', 'Houston', 'Jackson', 'Jefferson', 'Lamar', 'Lauderdale', 'Lawrence', 'Lee', 'Limestone', 'Lowndes', 'Macon', 'Madison', 'Marengo', 'Marion', 'Marshall', 'Mobile', 'Monroe', 'Montgomery', 'Morgan', 'Perry', 'Pickens', 'Pike', 'Randolph', 'Russell', 'Shelby', 'St. Clair', 'Sumter', 'Talladega', 'Tallapoosa', 'Tuscaloosa', 'Walker', 'Washington', 'Wilcox', 'Winston']\n" + ] + } + ], + "source": [ + "# complete the code below\n", + "\n", + "# locate the right button\n", + "button = driver.find_element(By.CSS_SELECTOR, \"button.rightButton\")\n", + "#button = driver.find_element(\"css selector\", \"button.rightButton\")\n", + "\n", + "output_ls = []\n", + "\n", + "while True:\n", + " try:\n", + " # pass the page source to beautifulsoup for scraping\n", + " soup = BeautifulSoup(driver.page_source, 'html.parser')\n", + " county_ls = soup.select('article.core-result div.header-container-1LzJY9 h2')\n", + " for county in county_ls:\n", + " output_ls.append(county.text)\n", + "\n", + " # click the right button\n", + " button.click()\n", + " \n", + " except:\n", + " print('done')\n", + " break\n", + " \n", + "print('Total # of counties: ', len(output_ls))\n", + "print(output_ls)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 3.1\n", + "Given a list of U.S. states, implement the code with for-loop, navigate to the pages of democratic primary results of all the listed states. Use Selenium `.get()` method and print each page title." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Alabama Presidential Democratic primary election results and maps 2024 | CNN Politics\n", + "American Samoa presidential Democratic caucuses election results and maps 2024 | CNN Politics\n", + "California Presidential Democratic primary election results and maps 2024 | CNN Politics\n", + "Florida Presidential Democratic primary election results and maps 2024 | CNN Politics\n", + "New York Presidential Democratic primary election results and maps 2024 | CNN Politics\n" + ] + } + ], + "source": [ + "# complete the code below\n", + "\n", + "selected_states = ['Alabama', 'American Samoa', 'California', 'Florida', 'New York']\n", + "\n", + "# fill in the prefix and suffix of the pages\n", + "prefix = \"https://edition.cnn.com/election/2024/primaries-and-caucuses/results/\"\n", + "suffix = \"/democratic-presidential-primary\"\n", + "\n", + "for i in selected_states:\n", + " # modify the state names\n", + " state_name = i.lower().replace(\" \", \"-\")\n", + " link = f'{prefix}{state_name}{suffix}'\n", + " driver.get(link)\n", + " print(driver.title)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Task 3.2 (Take home)\n", + "This time, visit also the pages of republican primary results and print each page title. " + ] + } + ], + "metadata": { + "interpreter": { + "hash": "b740d220f5ad61de4a5537b0747096853a9a4d33fec50636740be1cabf866fb1" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/gitUpdate.bat b/gitUpdate.bat new file mode 100644 index 0000000..dae269b --- /dev/null +++ b/gitUpdate.bat @@ -0,0 +1,7 @@ +git status . + +@pause + +git add . +git commit -m"update jzzzz123," +start git push \ No newline at end of file diff --git a/gitUpdate.sh b/gitUpdate.sh new file mode 100755 index 0000000..c96734f --- /dev/null +++ b/gitUpdate.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -ex + +git config --global http.version HTTP/1.1 +git config --global lfs.allowincompletepush true +git config --global lfs.locksverify true +git config --global http.postBuffer 5368709120 + +git add . + +git commit -m 'update,' + +git push + +echo "done" diff --git a/meta.md b/meta.md new file mode 100644 index 0000000..b6c7564 --- /dev/null +++ b/meta.md @@ -0,0 +1,7 @@ +--- +tags: scraping +--- + +# jzzzz123 + +## history