Skip to content

Commit a7536a1

Browse files
committed
add polls
1 parent 6a0eb1c commit a7536a1

File tree

3 files changed

+118
-28
lines changed

3 files changed

+118
-28
lines changed

lessons/1_Functions_and_Conditionals.ipynb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"🥊 **Challenge**: Interactive exercise. We'll work through these in the workshop!<br>\n",
2525
"💡 **Tip**: How to do something a bit more efficiently or effectively.<br>\n",
2626
"⚠️ **Warning:** Heads-up about tricky stuff or common mistakes.<br>\n",
27+
"📝 **Poll:** A Zoom poll to help you learn!<br>\n",
2728
"🎬 **Demo**: Showing off something more advanced – so you know what Python can be used for!<br>\n",
2829
"\n",
2930
"### Sections\n",
@@ -120,7 +121,7 @@
120121
"cell_type": "markdown",
121122
"metadata": {},
122123
"source": [
123-
"🔔 <span style=\"color:purple\"> **Question**: How many rows are in the data set?</span>"
124+
"📝 **Poll PyInt 1-1:** How many rows are in the data set?"
124125
]
125126
},
126127
{
@@ -343,7 +344,7 @@
343344
"source": [
344345
"In the code above, we create a function that adds 10 to whatever is passed into it as an argument.\n",
345346
"\n",
346-
"🔔 <span style=\"color:purple\"> **Question**: What happens when we `apply()` our function to the `year` column?</span>"
347+
"📝 **Poll PyInt 1-2:** What happens when we `apply()` our function to the `year` column?"
347348
]
348349
},
349350
{
@@ -630,7 +631,7 @@
630631
"cell_type": "markdown",
631632
"metadata": {},
632633
"source": [
633-
"## 🥊 <span style=\"color:purple\">Challenge 4: `apply()` a Conditional Function </span>\n",
634+
"## 🥊 Challenge 4: `apply()` a Conditional Function\n",
634635
"\n",
635636
"Let's put everything we've learned together.\n",
636637
"\n",
@@ -659,6 +660,13 @@
659660
"# YOUR CODE HERE\n"
660661
]
661662
},
663+
{
664+
"cell_type": "markdown",
665+
"metadata": {},
666+
"source": [
667+
"**📝 Poll PyInt 1-3:** What should our function return if `i == 6000`?"
668+
]
669+
},
662670
{
663671
"cell_type": "markdown",
664672
"metadata": {},

lessons/2_Iteration_and_Visualization.ipynb

Lines changed: 97 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"🥊 **Challenge**: Interactive exercise. We'll work through these in the workshop!<br>\n",
2727
"💡 **Tip**: How to do something a bit more efficiently or effectively.<br>\n",
2828
"⚠️ **Warning:** Heads-up about tricky stuff or common mistakes.<br>\n",
29+
"📝 **Poll:** A Zoom poll to help you learn!\n",
2930
"\n",
3031
"### Sections\n",
3132
"1. [Iteration: Loops](#iter)\n",
@@ -95,9 +96,11 @@
9596
"cell_type": "markdown",
9697
"metadata": {},
9798
"source": [
98-
"## 🥊 <span style=\"color:purple\">Challenge 1: Fixing Loop Syntax</span>\n",
99+
"## 🥊 Challenge 1: Fixing Loop Syntax\n",
99100
"\n",
100-
"The following block of code contains **three errors** that are preventing it from running properly. What are the errors? How would you fix them?"
101+
"The following block of code contains **three errors** that are preventing it from running properly. \n",
102+
"\n",
103+
"📝 **Poll PyInt 2-1:** What are the three errors?"
101104
]
102105
},
103106
{
@@ -295,11 +298,95 @@
295298
},
296299
{
297300
"cell_type": "code",
298-
"execution_count": null,
299-
"metadata": {},
300-
"outputs": [],
301-
"source": [
302-
"df = pd.read_csv('../data/gapminder_gni.csv')\n",
301+
"execution_count": 2,
302+
"metadata": {},
303+
"outputs": [
304+
{
305+
"data": {
306+
"text/html": [
307+
"<div><div id=882af88a-033f-431f-a12e-16e795baa656 style=\"display:none; background-color:#9D6CFF; color:white; width:200px; height:30px; padding-left:5px; border-radius:4px; flex-direction:row; justify-content:space-around; align-items:center;\" onmouseover=\"this.style.backgroundColor='#BA9BF8'\" onmouseout=\"this.style.backgroundColor='#9D6CFF'\" onclick=\"window.commands?.execute('create-mitosheet-from-dataframe-output');\">See Full Dataframe in Mito</div> <script> if (window.commands?.hasCommand('create-mitosheet-from-dataframe-output')) document.getElementById('882af88a-033f-431f-a12e-16e795baa656').style.display = 'flex' </script> <table border=\"1\" class=\"dataframe\">\n",
308+
" <thead>\n",
309+
" <tr style=\"text-align: right;\">\n",
310+
" <th></th>\n",
311+
" <th>country</th>\n",
312+
" <th>year</th>\n",
313+
" <th>pop</th>\n",
314+
" <th>continent</th>\n",
315+
" <th>lifeExp</th>\n",
316+
" <th>gdpPercap</th>\n",
317+
" <th>gniPercap</th>\n",
318+
" </tr>\n",
319+
" </thead>\n",
320+
" <tbody>\n",
321+
" <tr>\n",
322+
" <th>0</th>\n",
323+
" <td>Afghanistan</td>\n",
324+
" <td>1962</td>\n",
325+
" <td>10267083.0</td>\n",
326+
" <td>Asia</td>\n",
327+
" <td>31.997</td>\n",
328+
" <td>853.100710</td>\n",
329+
" <td>NaN</td>\n",
330+
" </tr>\n",
331+
" <tr>\n",
332+
" <th>1</th>\n",
333+
" <td>Afghanistan</td>\n",
334+
" <td>1967</td>\n",
335+
" <td>11537966.0</td>\n",
336+
" <td>Asia</td>\n",
337+
" <td>34.020</td>\n",
338+
" <td>836.197138</td>\n",
339+
" <td>NaN</td>\n",
340+
" </tr>\n",
341+
" <tr>\n",
342+
" <th>2</th>\n",
343+
" <td>Afghanistan</td>\n",
344+
" <td>1972</td>\n",
345+
" <td>13079460.0</td>\n",
346+
" <td>Asia</td>\n",
347+
" <td>36.088</td>\n",
348+
" <td>739.981106</td>\n",
349+
" <td>NaN</td>\n",
350+
" </tr>\n",
351+
" <tr>\n",
352+
" <th>3</th>\n",
353+
" <td>Afghanistan</td>\n",
354+
" <td>1977</td>\n",
355+
" <td>14880372.0</td>\n",
356+
" <td>Asia</td>\n",
357+
" <td>38.438</td>\n",
358+
" <td>786.113360</td>\n",
359+
" <td>NaN</td>\n",
360+
" </tr>\n",
361+
" <tr>\n",
362+
" <th>4</th>\n",
363+
" <td>Afghanistan</td>\n",
364+
" <td>1982</td>\n",
365+
" <td>12881816.0</td>\n",
366+
" <td>Asia</td>\n",
367+
" <td>39.854</td>\n",
368+
" <td>978.011439</td>\n",
369+
" <td>NaN</td>\n",
370+
" </tr>\n",
371+
" </tbody>\n",
372+
"</table></div>"
373+
],
374+
"text/plain": [
375+
" country year pop continent lifeExp gdpPercap gniPercap\n",
376+
"0 Afghanistan 1962 10267083.0 Asia 31.997 853.100710 NaN\n",
377+
"1 Afghanistan 1967 11537966.0 Asia 34.020 836.197138 NaN\n",
378+
"2 Afghanistan 1972 13079460.0 Asia 36.088 739.981106 NaN\n",
379+
"3 Afghanistan 1977 14880372.0 Asia 38.438 786.113360 NaN\n",
380+
"4 Afghanistan 1982 12881816.0 Asia 39.854 978.011439 NaN"
381+
]
382+
},
383+
"execution_count": 2,
384+
"metadata": {},
385+
"output_type": "execute_result"
386+
}
387+
],
388+
"source": [
389+
"df = pd.read_csv('~/Documents/GitHub/DEV/Python-Intermediate-Pilot/data/gapminder_gni.csv')\n",
303390
"df.head()"
304391
]
305392
},
@@ -424,7 +511,7 @@
424511
"cell_type": "markdown",
425512
"metadata": {},
426513
"source": [
427-
"🔔 <span style=\"color:purple\">**Question**: Why are only some of the columns in the `DataFrame` visible in the output?</span>"
514+
"📝 **Poll PyInt 2-2:** Why are only some of the columns in the `DataFrame` visible in the output?"
428515
]
429516
},
430517
{
@@ -522,13 +609,6 @@
522609
"low_lifeExp.plot.bar(x='country', y='lifeExp', figsize=(6,4));"
523610
]
524611
},
525-
{
526-
"cell_type": "markdown",
527-
"metadata": {},
528-
"source": [
529-
"🔔 <span style=\"color:purple\">**Question**: Do you notice any pattern in the data?</span>"
530-
]
531-
},
532612
{
533613
"cell_type": "markdown",
534614
"metadata": {},
@@ -619,7 +699,7 @@
619699
"\n",
620700
"A histogram shows the distribution of a variable using binned values. We can call this using the syntax: `df[column].plot(kind='hist')`. Use a histogram if you want to show distributions of continuous variables.\n",
621701
"\n",
622-
"🔔 <span style=\"color:purple\">**Question**: Try changing the value for the `bins` parameter. What is happening?</span>"
702+
"📝 **Poll PyInt 2-3:** Try changing the value for the `bins` parameter. What does the `bins` parameter seem to be determining?</span>"
623703
]
624704
},
625705
{
@@ -666,7 +746,7 @@
666746
" plt.legend()\n",
667747
" plt.show()\n",
668748
"\n",
669-
"plot_life_expectancy(df, countries)"
749+
"plot_life_expectancy(df, country_list)"
670750
]
671751
},
672752
{

lessons/3_Project.ipynb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"🔔 **Question**: A quick question to help you understand what's going on.<br>\n",
2626
"🥊 **Challenge**: Interactive exercise. We'll work through these in the workshop!<br>\n",
2727
"💡 **Tip**: How to do something a bit more efficiently or effectively.<br>\n",
28-
"⚠️ **Warning:** Heads-up about tricky stuff or common mistakes.\n",
28+
"⚠️ **Warning:** Heads-up about tricky stuff or common mistakes.<br>\n",
29+
"📝 **Poll:** A Zoom poll to help you learn!\n",
30+
"\n",
2931
"\n",
3032
"### Sections\n",
3133
"1. [🚀 Project](#project)\n",
@@ -54,7 +56,7 @@
5456
"- `household_tenure`: Self-Reported household tenure\n",
5557
"- `interview_language`: Language of interview\n",
5658
"\n",
57-
"For this 🚀 Project, the goal we want to accomplish is **visualizing the relationship between poverty level and general health**. We will bring together basic programming and data science techniques you have learned to do this.\n",
59+
"For this project, the goal we want to accomplish is **visualizing the relationship between poverty level and general health**. We will bring together basic programming and data science techniques you have learned to do this.\n",
5860
"\n",
5961
"🔔 **Question**: Are there other research questions you could imagine asking with this dataset?"
6062
]
@@ -178,7 +180,7 @@
178180
"source": [
179181
"🔔 **Question**: Let's take a look at the final data frame.\n",
180182
"\n",
181-
"1. <span style=\"color:purple\"> How many rows and columns are there in the concatenated DataFrame?</span>\n",
183+
"1. How many rows and columns are there in the concatenated DataFrame?\n",
182184
"2. How many numeric columns are there in the dataset?\n",
183185
"3. What data type are the values in the `poverty_level` column?\n"
184186
]
@@ -246,9 +248,9 @@
246248
"Now that we have preprocessed data, we want to analyze it. Recall that our goal is to visualize a relationship between poverty level and general health. Before we do this, we should get a better grasp of what is in our data.\n",
247249
"\n",
248250
"## Counting Values\n",
249-
"The first thing we will want to do is count values of poverty levels: we want to see how many levels there are, and how the data are distributed. \n",
250-
"1. Run `value_counts()` on the `poverty_level` column. \n",
251-
"2. <span style=\"color:purple\"> Look through the [documentation](https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html) and **normalize** the output of `value_counts()`.</span>"
251+
"The first thing we will want to do is count values of poverty levels: we want to see how many levels there are, and how the data are distributed. First, run `value_counts()` on the `poverty_level` column. \n",
252+
"\n",
253+
"📝 **Poll - PyInt 3-1**: Look through the [documentation](https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html) for `value_counts()`. What parameter can you use to normalize the output?\n"
252254
]
253255
},
254256
{
@@ -348,7 +350,7 @@
348350
"Fill in the blanks below, following the steps. \n",
349351
"\n",
350352
"1. Run a **normalized** `value_counts()` on the `general_health` column of `df_above` and `df_below`.\n",
351-
"2. Run `plot()` on the output of the resulting DataFrame. Enter the values for two arguments: `kind` must be set to `bar`, and `alpha` must be set to `.5`.\n"
353+
"2. We are running `plot()` on the output of the resulting DataFrame. Enter the values for two arguments: `kind` must be set to `bar`, and `alpha` must be set to `.5`.\n"
352354
]
353355
},
354356
{
@@ -368,7 +370,7 @@
368370
"cell_type": "markdown",
369371
"metadata": {},
370372
"source": [
371-
"🔔 <span style=\"color:purple\"> **Question**: What is the `alpha` parameter doing? Read through the [documentation](https://pandas.pydata.org/docs/user_guide/visualization.html) to find out.</span>"
373+
"📝 **Poll - PyInt 3-2**:What is the `alpha` parameter doing? Read through the [documentation](https://pandas.pydata.org/docs/user_guide/visualization.html) to find out.</span>"
372374
]
373375
},
374376
{

0 commit comments

Comments
 (0)