Skip to content

Commit 2ebf9c7

Browse files
authored
Merge pull request #13 from fhdsl/season9
adding slides
2 parents fc174d7 + c185401 commit 2ebf9c7

7 files changed

Lines changed: 558 additions & 484 deletions

File tree

index.qmd

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The course is intended for researchers who want to continue learning the fundame
1010

1111
- **Understand and distinguish** the use case of data structures to store different types of data.
1212

13-
- **Implement** code to Iterate over a collection (such as files, elements of a column, or a list of objects) to batch process each item.
13+
- **Implement** code to iterate over a collection (such as files, elements of a column, or a list of objects) to batch process each item.
1414

1515
- **Implement** code that has a branching structure depending on input data's condition.
1616

@@ -39,13 +39,13 @@ All classes are on Wednesdays from 12:00-1:30 PM PST either online, or in Arnold
3939

4040
| Week | Date | Topic |
4141
|------|------|-------|
42-
|1* | Jan 21 | Fundamentals |
43-
|2 | Jan 28 | Iteration (for loops) |
44-
|3* | Feb 4 | Conditionals |
45-
|4 | Feb 11 | Functions |
42+
|1* | Jan 21 | [Fundamentals](01-Fundamentals.qmd) |
43+
|2 | Jan 28 | [Iteration (for loops)](02-Iteration.qmd) |
44+
|3* | Feb 4 | [Conditionals](03-Conditionals.qmd) |
45+
|4 | Feb 11 | [Functions](04-Functions.qmd) |
4646
|No Class | Feb 18 | Break week |
47-
|5 | Feb 25 |Iteration Styles |
48-
|6* | Mar 4 | Last Day of Class |
47+
|5 | Feb 25 | [Iteration Styles](05-Iteration_Styles.qmd) |
48+
|6* | Mar 4 | [Reference vs. Copy](06-Reference_vs_Copy.qmd) / Last Day of Class |
4949

5050
* = Ted on Campus for class
5151

@@ -62,12 +62,19 @@ We will spend the first 20-25 minutes of each class on catching up on last week'
6262

6363
## First Class Survey
6464

65-
[First Class Survey](https://forms.gle/smj4wFAQufoHsG6h7) - Please fill out. We mostly want to see how confident you are before and after class. We will share these results with everyone (anonymized).
65+
[First Class Survey](https://forms.gle/hGQLZ5AgS6Cs3aW57) - Please fill out. We mostly want to see how confident you are before and after class. We will share these results with everyone (anonymized).
6666

6767
## Weekly Check In
6868

69-
[Weekly Check In Form](https://forms.gle/obwC5GYAA3iPHk5x7) - please fill out to let us know if you have any issues or want to share what you've learned. We look at the answers in aggregate and we anonymize responses (unless you want us to know).
69+
[Weekly Check In Form](https://forms.gle/SaVk8oH6ezWfKaHM7) - please fill out to let us know if you have any issues or want to share what you've learned. We look at the answers in aggregate and we anonymize responses (unless you want us to know).
7070

71+
## Weekly Cheatsheet
72+
73+
I will be posting the recordings, solutions, and notes using the Weekly Cheatsheet. This link will be sent to you.
74+
75+
## Google Classroom
76+
77+
We will be using Google Classroom for exercises. Be sure to submit your exercises through there (it is the main mechanism for us to check them).
7178

7279
## Culture of the course
7380

@@ -105,4 +112,4 @@ Requirements:
105112

106113
## Offerings
107114

108-
This course is taught on a regular basis at [Fred Hutch Cancer Center](https://www.fredhutch.org/) through the [Data Science Lab](https://hutchdatascience.org/). Announcements of course offering can be found [here](https://hutchdatascience.org/training/).
115+
This course is taught on a regular basis at [Fred Hutch Cancer Center](https://www.fredhutch.org/) through the [Data Science Lab](https://ocdo.fredhutch.org/dasl/). Announcements of course offering can be found [here](https://ocdo.fredhutch.org/dasl/courses/).

slides/lesson1_slides.html

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ <h1 class="title">W1: Fundamentals</h1>
204204
</section>
205205
<section id="welcome" class="slide level2">
206206
<h2>Welcome!</h2>
207-
<p>Please sign up for Google Classroom (<a href="https://classroom.google.com/c/ODIzOTg2OTExNzU5?cjc=qfqni3j4">link</a> if you haven’t already.</p>
207+
<p>Please sign up for Google Classroom (<a href="https://classroom.google.com/c/ODIzOTg2OTExNzU5?cjc=qfqni3j4">link</a>) if you haven’t already.</p>
208208
</section>
209209
<section id="introductions" class="slide level2">
210210
<h2>Introductions</h2>
@@ -244,18 +244,63 @@ <h2>Goals of the course</h2>
244244
<h2><a href="https://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharing">A Motivating Example</a></h2>
245245
<p><a href="https://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharinghttps://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharing">https://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharing</a></p>
246246
</section>
247-
<section id="content-of-the-course" class="slide level2 scrollable">
248-
<h2>Content of the course</h2>
249-
<ol type="1">
250-
<li>Fundamentals and Dictionaries</li>
251-
<li>Iteration</li>
252-
<li>Functions</li>
253-
<li>Iteration styles</li>
254-
<li>Assignment and References</li>
255-
<li>Mid-winter break! (for Seattle Public Schools)</li>
256-
<li>Modules, Wrap-up, Pizza!</li>
257-
<li>Optional: Data-a-thon Friday March 14, Learning Communities</li>
258-
</ol>
247+
<section id="tentative-schedule" class="slide level2">
248+
<h2>Tentative Schedule</h2>
249+
<table class="caption-top">
250+
<thead>
251+
<tr class="header">
252+
<th>Week</th>
253+
<th>Date</th>
254+
<th>Topic</th>
255+
</tr>
256+
</thead>
257+
<tbody>
258+
<tr class="odd">
259+
<td>1*</td>
260+
<td>Jan 21</td>
261+
<td><a href="01-Fundamentals.qmd">Fundamentals</a></td>
262+
</tr>
263+
<tr class="even">
264+
<td>2</td>
265+
<td>Jan 28</td>
266+
<td><a href="02-Iteration.qmd">Iteration (for loops)</a></td>
267+
</tr>
268+
<tr class="odd">
269+
<td>3*</td>
270+
<td>Feb 4</td>
271+
<td><a href="03-Conditionals.qmd">Conditionals</a></td>
272+
</tr>
273+
<tr class="even">
274+
<td>4</td>
275+
<td>Feb 11</td>
276+
<td><a href="04-Functions.qmd">Functions</a></td>
277+
</tr>
278+
<tr class="odd">
279+
<td>No Class</td>
280+
<td>Feb 18</td>
281+
<td>Break week</td>
282+
</tr>
283+
<tr class="even">
284+
<td>5</td>
285+
<td>Feb 25</td>
286+
<td><a href="05-Iteration_Styles.qmd">Iteration Styles</a></td>
287+
</tr>
288+
<tr class="odd">
289+
<td>6*</td>
290+
<td>Mar 4</td>
291+
<td><a href="06-Reference_vs_Copy.qmd">Reference vs.&nbsp;Copy</a> / Last Day of Class</td>
292+
</tr>
293+
</tbody>
294+
</table>
295+
<ul>
296+
<li>= Ted on Campus for class</li>
297+
</ul>
298+
</section>
299+
<section id="more-about-the-schedule" class="slide level2">
300+
<h2>More About the Schedule</h2>
301+
<p>All classes are on Wednesdays from 12:00-1:30 PM PST either online, or in Arnold M1-B406 (The Data Science Lounge). Connection details will be provided. Office hours related to each class day are posted below, and the invite will be sent to you.</p>
302+
<p>In class we will be going through the notebooks hosted on Google Classroom.</p>
303+
<p>Classes will be recorded, and those recordings will be sent to you after each class.</p>
259304
<p>Full course page here: <a href="https://hutchdatascience.org/Intermediate_Python/" class="uri">https://hutchdatascience.org/Intermediate_Python/</a></p>
260305
</section>
261306
<section id="format-of-the-course" class="slide level2">
@@ -438,7 +483,7 @@ <h2>Break!</h2>
438483
<h2>Dictionary</h2>
439484
<p>A <strong>dictionary</strong> is designed as a lookup table, organized in <strong>key-value</strong> pairs. You associate the key with a particular value, and use the key to find the value.</p>
440485
<div class="fragment">
441-
<div id="7b7e440d" class="cell" data-execution_count="1">
486+
<div id="ce5f920e" class="cell" data-execution_count="1">
442487
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href=""></a>sentiment <span class="op">=</span> {<span class="st">'happy'</span>: <span class="dv">8</span>, <span class="st">'sad'</span>: <span class="dv">2</span>, <span class="st">'joy'</span>: <span class="fl">7.5</span>, <span class="st">'embarrassed'</span>: <span class="fl">3.6</span>, <span class="st">'restless'</span>: <span class="fl">4.1</span>, <span class="st">'apathetic'</span>: <span class="fl">3.8</span>, <span class="st">'calm'</span>: <span class="dv">7</span>}</span>
443488
<span id="cb1-2"><a href=""></a>sentiment</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
444489
<div class="cell-output cell-output-display" data-execution_count="1">
@@ -454,7 +499,7 @@ <h2>Dictionary</h2>
454499
</div>
455500
<div class="fragment">
456501
<p>You use a key to find its corresponding value:</p>
457-
<div id="a144a640" class="cell" data-execution_count="2">
502+
<div id="6c8ea957" class="cell" data-execution_count="2">
458503
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href=""></a>sentiment[<span class="st">'joy'</span>]</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
459504
<div class="cell-output cell-output-display" data-execution_count="2">
460505
<pre><code>7.5</code></pre>
@@ -463,7 +508,7 @@ <h2>Dictionary</h2>
463508
</div>
464509
<div class="fragment">
465510
<p>You cannot use a numerical index to find values, like you did for Lists!</p>
466-
<div id="83b7d28b" class="cell" data-execution_count="3">
511+
<div id="2bf03ed1" class="cell" data-execution_count="3">
467512
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href=""></a><span class="co">#sentiment[0]</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
468513
</div>
469514
</div>
@@ -484,7 +529,7 @@ <h2>Rules of Dictionaries</h2>
484529
</ul>
485530
</div>
486531
<div class="fragment">
487-
<div id="f480f6d6" class="cell" data-execution_count="4">
532+
<div id="9ae10012" class="cell" data-execution_count="4">
488533
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href=""></a>duplicated_keys <span class="op">=</span> {<span class="st">'Student'</span> : <span class="dv">97</span>, <span class="st">'Student'</span>: <span class="dv">88</span>, <span class="st">'Student'</span> : <span class="dv">91</span>}</span>
489534
<span id="cb6-2"><a href=""></a>duplicated_keys</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
490535
<div class="cell-output cell-output-display" data-execution_count="4">
@@ -493,12 +538,12 @@ <h2>Rules of Dictionaries</h2>
493538
</div>
494539
</div>
495540
<div class="fragment">
496-
<div id="b025fa77" class="cell" data-execution_count="5">
541+
<div id="baed7d9c" class="cell" data-execution_count="5">
497542
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href=""></a>child <span class="op">=</span> {<span class="st">"name"</span> : <span class="st">"Emil"</span>, <span class="st">"year"</span> : <span class="dv">2004</span>, <span class="st">"likes"</span>: [<span class="st">"jumping"</span>, <span class="st">"skating"</span>, <span class="st">"laughing"</span>]}</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
498543
</div>
499544
</div>
500545
<div class="fragment">
501-
<div id="f722d433" class="cell" data-execution_count="6">
546+
<div id="79407544" class="cell" data-execution_count="6">
502547
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href=""></a>child[<span class="st">"likes"</span>][<span class="dv">1</span>]</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
503548
<div class="cell-output cell-output-display" data-execution_count="6">
504549
<pre><code>'skating'</code></pre>
@@ -511,34 +556,34 @@ <h2>Rules of Dictionaries</h2>
511556
</section>
512557
<section id="using-key-to-find-values" class="slide level2">
513558
<h2>Using key to find values</h2>
514-
<div id="c73555d8" class="cell" data-execution_count="7">
559+
<div id="7fedb222" class="cell" data-execution_count="7">
515560
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href=""></a>sentiment[<span class="st">'joy'</span>] </span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
516561
<div class="cell-output cell-output-display" data-execution_count="7">
517562
<pre><code>7.5</code></pre>
518563
</div>
519564
</div>
520565
<div class="fragment">
521-
<div id="345a0174" class="cell" data-execution_count="8">
566+
<div id="ffc517a9" class="cell" data-execution_count="8">
522567
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb13"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href=""></a>sentiment[<span class="st">'joy'</span>] <span class="op">=</span> sentiment[<span class="st">'joy'</span>] <span class="op">+</span> <span class="dv">1</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
523568
</div>
524569
</div>
525570
<div class="fragment">
526571
<p>If a key doesn’t exist, you will get an error:</p>
527-
<div id="fd15e92c" class="cell" data-execution_count="9">
572+
<div id="3c7cfbaa" class="cell" data-execution_count="9">
528573
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb14-1"><a href=""></a><span class="co">#sentiment["dog"]</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
529574
</div>
530575
</div>
531576
<div class="fragment">
532577
<p>If you don’t want to run the risk of getting an error, you can specify a default value using the <code>.get()</code> method.</p>
533-
<div id="d34dc435" class="cell" data-execution_count="10">
578+
<div id="147cfd97" class="cell" data-execution_count="10">
534579
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb15"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb15-1"><a href=""></a>sentiment.get(<span class="st">"dog"</span>, <span class="st">"not found"</span>)</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
535580
<div class="cell-output cell-output-display" data-execution_count="10">
536581
<pre><code>'not found'</code></pre>
537582
</div>
538583
</div>
539584
</div>
540585
<div class="fragment">
541-
<div id="a46bbb1b" class="cell" data-execution_count="11">
586+
<div id="98c35aa2" class="cell" data-execution_count="11">
542587
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb17"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb17-1"><a href=""></a><span class="bu">print</span>(sentiment.get(<span class="st">"dog"</span>))</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
543588
<div class="cell-output cell-output-stdout">
544589
<pre><code>None</code></pre>
@@ -549,14 +594,14 @@ <h2>Using key to find values</h2>
549594
<section id="adding-new-key-value-pairs" class="slide level2">
550595
<h2>Adding new key-value pairs</h2>
551596
<p>You can add more key-value pairs by defining it directly. If the key already exists, the mapping for that key will simply be updated.</p>
552-
<div id="eeb903c8" class="cell" data-execution_count="12">
597+
<div id="6462a199" class="cell" data-execution_count="12">
553598
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb19"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb19-1"><a href=""></a>sentiment[<span class="st">'dog'</span>] <span class="op">=</span> <span class="dv">5</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
554599
</div>
555600
</section>
556601
<section id="application-creating-a-dataframe" class="slide level2">
557602
<h2>Application: Creating a Dataframe</h2>
558603
<p>You can create a Dataframe using a Dictionary. The key represent column names, and the value is a List containing the column’s values:</p>
559-
<div id="a4b3cd3e" class="cell" data-execution_count="13">
604+
<div id="3d2980fc" class="cell" data-execution_count="13">
560605
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb20"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb20-1"><a href=""></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
561606
<span id="cb20-2"><a href=""></a></span>
562607
<span id="cb20-3"><a href=""></a>simple_df <span class="op">=</span> pd.DataFrame(data<span class="op">=</span>{<span class="st">'id'</span>: [<span class="st">"AAA"</span>, <span class="st">"BBB"</span>, <span class="st">"CCC"</span>, <span class="st">"DDD"</span>, <span class="st">"EEE"</span>],</span>
@@ -645,7 +690,7 @@ <h2>Application: Creating a Dataframe</h2>
645690
<h2>Application: Data Recoding</h2>
646691
<p>You want to take “case_control” column of <code>simple_df</code> and change “case” to “experiment” and “control” to “baseline”.</p>
647692
<p>This correspondence relationship can be stored in a dictionary via <code>.replace()</code> method for Series:</p>
648-
<div id="bf924f7b" class="cell" data-execution_count="14">
693+
<div id="08d5fc92" class="cell" data-execution_count="14">
649694
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb21"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb21-1"><a href=""></a>simple_df.case_control.replace({<span class="st">"case"</span>: <span class="st">"experiment"</span>, <span class="st">"control"</span>: <span class="st">"baseline"</span>})</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
650695
<div class="cell-output cell-output-display" data-execution_count="14">
651696
<pre><code>0 experiment

slides/lesson1_slides.qmd

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ format:
55
smaller: false
66
scrollable: true
77
echo: true
8+
standalone: true
89
---
910

1011
## Welcome!
1112

12-
Please sign up for Google Classroom ([link](https://classroom.google.com/c/ODIzOTg2OTExNzU5?cjc=qfqni3j4) if you haven't already.
13+
Please sign up for Google Classroom ([link](https://classroom.google.com/c/ODIzOTg2OTExNzU5?cjc=qfqni3j4)) if you haven't already.
1314

1415
## Introductions
1516

@@ -43,16 +44,30 @@ Please sign up for Google Classroom ([link](https://classroom.google.com/c/ODIzO
4344

4445
[https://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharing](https://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharinghttps://colab.research.google.com/drive/1g2ylY3-s_jX2Yf2CGkIdApvgTP4vb0Dw?usp=sharing)
4546

46-
## Content of the course
47+
## Tentative Schedule
48+
49+
| Week | Date | Topic |
50+
|------|------|-------|
51+
|1* | Jan 21 | [Fundamentals](01-Fundamentals.qmd) |
52+
|2 | Jan 28 | [Iteration (for loops)](02-Iteration.qmd) |
53+
|3* | Feb 4 | [Conditionals](03-Conditionals.qmd) |
54+
|4 | Feb 11 | [Functions](04-Functions.qmd) |
55+
|No Class | Feb 18 | Break week |
56+
|5 | Feb 25 | [Iteration Styles](05-Iteration_Styles.qmd) |
57+
|6* | Mar 4 | [Reference vs. Copy](06-Reference_vs_Copy.qmd) / Last Day of Class |
58+
59+
* = Ted on Campus for class
60+
61+
62+
## More About the Schedule
63+
64+
All classes are on Wednesdays from 12:00-1:30 PM PST either online, or in Arnold M1-B406 (The Data Science Lounge). Connection details will be provided. Office hours related to each class day are posted below, and the invite will be sent to you.
65+
66+
67+
In class we will be going through the notebooks hosted on Google Classroom.
68+
69+
Classes will be recorded, and those recordings will be sent to you after each class.
4770

48-
1. Fundamentals and Dictionaries
49-
2. Iteration
50-
3. Functions
51-
4. Iteration styles
52-
5. Assignment and References
53-
6. Mid-winter break! (for Seattle Public Schools)
54-
7. Modules, Wrap-up, Pizza!
55-
8. Optional: Data-a-thon Friday March 14, Learning Communities
5671

5772
Full course page here: <https://hutchdatascience.org/Intermediate_Python/>
5873

0 commit comments

Comments
 (0)