diff --git a/Wisconsin_breast_cancer_data.ipynb b/Wisconsin_breast_cancer_data.ipynb index 7ac5ab8..fc15145 100755 --- a/Wisconsin_breast_cancer_data.ipynb +++ b/Wisconsin_breast_cancer_data.ipynb @@ -2,7 +2,11 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, "source": [ "# Python for data analysis" ] @@ -76,7 +80,7 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "slide" + "slide_type": "skip" } }, "source": [ @@ -88,7 +92,7 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "subslide" + "slide_type": "skip" } }, "source": [ @@ -103,7 +107,7 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "subslide" + "slide_type": "skip" } }, "source": [ @@ -122,11 +126,12 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "fragment" + "slide_type": "slide" } }, "source": [ - "**Spyder** - a Python IDE with matlab-like interface." + "### [Spyder](https://www.spyder-ide.org/) - a Python Development Environment with matlab-like interface.\n", + "![Spyder](https://www.spyder-ide.org/static/images/spyder_website_banner.png)" ] }, { @@ -210,33 +215,32 @@ { "cell_type": "markdown", "metadata": { + "colab_type": "text", "slideshow": { - "slide_type": "fragment" + "slide_type": "subslide" } }, "source": [ - "# Do not upload work data on the cloud \n", - "# without checking with your employer " + "\n", + "### Pros of cloud environments\n", + " 1. Somebody else manages it for you\n", + " 2. You get access to pretty good hardware\n", + " 4. Easy to access from anywhere with internet connection.\n", + " 5. Easy to share and collaborate with others\n", + " \n", + " \n" ] }, { "cell_type": "markdown", "metadata": { - "colab_type": "text", "slideshow": { - "slide_type": "subslide" + "slide_type": "fragment" } }, "source": [ - "\n", - "### Cons of local environments\n", - " 1. You have to set up and manage it\n", - " 2. You are limited by the hardware you have (may be expensive)\n", - " 3. Not the optimal use of resources\n", - " 4. Not easy to access from elsewhere\n", - " 5. Not easy to share and collaborate with others\n", - " \n", - " \n" + "# Do not upload work data on the cloud \n", + "# without checking with your employer " ] }, { @@ -255,7 +259,7 @@ " - Array creation, Arithmetic, Access and Manipulation\n", " - Loading data into array\n", " - Handling missing values\n", - " - Selection of data\n", + " - Selection of data\n", "- Pandas basics\n", " - Loading data\n", " - Column selction\n", @@ -408,7 +412,6 @@ } }, "source": [ - "- Code cells are indicated by an empty pair of brackets `[ ]` before them. You can also recognize them from syntax highlighting. Once the code is run, a number appears between the brackets.\n", "- Keep pressing `Shift+Enter` to move down this notebook and run the code wherever appropriate." ] }, @@ -607,7 +610,7 @@ }, "outputs": [], "source": [ - "print(a[1])" + "print(a[1]) # Indexing" ] }, { @@ -620,7 +623,7 @@ }, "outputs": [], "source": [ - "print(a[3:16])" + "print(a[3:16]) # Slicing" ] }, { @@ -633,7 +636,7 @@ }, "outputs": [], "source": [ - "print(a[0:15:4])" + "print(a[0:15:4]) # Slicing with step" ] }, { @@ -657,7 +660,7 @@ }, "outputs": [], "source": [ - "mylist = [1, 2, 'A string', 3.14] # this is called list\n", + "mylist = [1, 2, 'A string', 3.14]\n", "print(mylist)" ] }, @@ -685,7 +688,7 @@ }, "outputs": [], "source": [ - "print(mylist[1])" + "print(mylist[1]) # indexing" ] }, { @@ -730,9 +733,13 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, "source": [ - "Uncomment and run below." + "*Uncomment and run below.*" ] }, { @@ -798,18 +805,18 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": { "slideshow": { "slide_type": "fragment" } }, + "outputs": [], "source": [ - "```python\n", - "\n", + "a = 123\n", "if a < 0:\n", - " print('a is negative')\n", - "```" + " print('a is negative')" ] }, { @@ -831,40 +838,38 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": { "slideshow": { "slide_type": "subslide" } }, + "outputs": [], "source": [ - "```python\n", - "\n", "if a < 0:\n", " print('a is negative')\n", "else:\n", - " print('not negative')\n", - " ```" + " print('not negative')" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": { "slideshow": { "slide_type": "subslide" } }, + "outputs": [], "source": [ - "```python\n", - "\n", "if a < 0: \n", " print('a is negative')\n", "elif a > 0:\n", " print('a is positive')\n", "else:\n", " print('a == 0')\n", - " ```\n", - "You can put as many `elif`s as you need. No `case` structure like C." + "# You can put as many `elif`s as you need. No `case` structure like C." ] }, { @@ -887,14 +892,23 @@ } }, "source": [ - "#### `for loop` for looping over sequence of elements.\n", - "\n", - "```python\n", - " x = ['alpha', 'bravo', 'charlie', 'delta']\n", - " for ii in x:\n", - " print(ii)\n", - " \n", - "``` " + "#### `for loop` for looping over sequence of elements." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab_type": "text", + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [], + "source": [ + "x = ['alpha', 'bravo', 'charlie', 'delta']\n", + "for ii in x:\n", + " print(ii) " ] }, { @@ -906,14 +920,24 @@ } }, "source": [ - "#### `while loop` for conditional looping.\n", - " ```python\n", + "#### `while loop` for conditional looping." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab_type": "text", + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ "x = 0\n", - "while x < 10:\n", + "while x < 4:\n", " print(x)\n", - " x += 1\n", - " \n", - " ```" + " x += 1" ] }, { @@ -1010,7 +1034,8 @@ }, "outputs": [], "source": [ - "from matplotlib import pyplot as plt # import only specific part of a module" + "import matplotlib.pyplot as plt # import a sub-module\n", + "# Could also write `from matplotlib import pyplot as plt`" ] }, { @@ -1022,7 +1047,7 @@ }, "source": [ "### Getting help\n", - "Type this in a code cell below, then (with cursor at after the `y`) hold `shift` and press tab `tab` (once, twice, thrice, four times).\n", + "Type this in a code cell below, then (with cursor after the `y`) hold `shift` and press tab `tab` (once, twice, thrice, four times).\n", "```python\n", "a0 = np.array```" ] @@ -1235,22 +1260,7 @@ }, "outputs": [], "source": [ - "2**myarray" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "colab": {}, - "colab_type": "code", - "slideshow": { - "slide_type": "fragment" - } - }, - "outputs": [], - "source": [ - "2*myarray2" + "myarray2**2" ] }, { @@ -1265,27 +1275,16 @@ }, "outputs": [], "source": [ - "myarray2**2" + "myarray2 + 2" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": { - "colab": {}, - "colab_type": "code", "slideshow": { "slide_type": "fragment" } }, - "outputs": [], - "source": [ - "myarray2 + 2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, "source": [ "Uncomment below and execute" ] @@ -1756,7 +1755,11 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, "source": [ "#### Explain what is going on below" ] @@ -2391,9 +2394,13 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, "source": [ - "Uncomment below and execute." + "*Uncomment below and execute.*" ] }, { @@ -2423,6 +2430,13 @@ " This is called a stack trace - when one function calls another function, which calls another function, etc., and an inner funtion encounters an error, it shows the outer most function first, and then goes deeper and deeper until the source of the error." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null, @@ -2804,7 +2818,11 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, "source": [ "*Uncomment below and run*" ] @@ -2843,7 +2861,7 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "slide" + "slide_type": "skip" } }, "source": [ @@ -2857,7 +2875,7 @@ "colab": {}, "colab_type": "code", "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [], @@ -2870,7 +2888,7 @@ "metadata": { "colab_type": "text", "slideshow": { - "slide_type": "subslide" + "slide_type": "skip" } }, "source": [ @@ -2884,7 +2902,7 @@ "execution_count": null, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [], @@ -2897,7 +2915,7 @@ "execution_count": null, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [], @@ -2910,7 +2928,7 @@ "execution_count": null, "metadata": { "slideshow": { - "slide_type": "subslide" + "slide_type": "skip" } }, "outputs": [], @@ -2925,7 +2943,7 @@ "colab": {}, "colab_type": "code", "slideshow": { - "slide_type": "subslide" + "slide_type": "skip" } }, "outputs": [], @@ -3075,7 +3093,7 @@ } }, "source": [ - "## Plotting data" + "# Plotting with `matplotlib`" ] }, {