|
26 | 26 | "🥊 **Challenge**: Interactive exercise. We'll work through these in the workshop!<br>\n",
|
27 | 27 | "💡 **Tip**: How to do something a bit more efficiently or effectively.<br>\n",
|
28 | 28 | "⚠️ **Warning:** Heads-up about tricky stuff or common mistakes.<br>\n",
|
| 29 | + "📝 **Poll:** A Zoom poll to help you learn!\n", |
29 | 30 | "\n",
|
30 | 31 | "### Sections\n",
|
31 | 32 | "1. [Iteration: Loops](#iter)\n",
|
|
95 | 96 | "cell_type": "markdown",
|
96 | 97 | "metadata": {},
|
97 | 98 | "source": [
|
98 |
| - "## 🥊 <span style=\"color:purple\">Challenge 1: Fixing Loop Syntax</span>\n", |
| 99 | + "## 🥊 Challenge 1: Fixing Loop Syntax\n", |
99 | 100 | "\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?" |
101 | 104 | ]
|
102 | 105 | },
|
103 | 106 | {
|
|
295 | 298 | },
|
296 | 299 | {
|
297 | 300 | "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", |
303 | 390 | "df.head()"
|
304 | 391 | ]
|
305 | 392 | },
|
|
424 | 511 | "cell_type": "markdown",
|
425 | 512 | "metadata": {},
|
426 | 513 | "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?" |
428 | 515 | ]
|
429 | 516 | },
|
430 | 517 | {
|
|
522 | 609 | "low_lifeExp.plot.bar(x='country', y='lifeExp', figsize=(6,4));"
|
523 | 610 | ]
|
524 | 611 | },
|
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 |
| - }, |
532 | 612 | {
|
533 | 613 | "cell_type": "markdown",
|
534 | 614 | "metadata": {},
|
|
619 | 699 | "\n",
|
620 | 700 | "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",
|
621 | 701 | "\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>" |
623 | 703 | ]
|
624 | 704 | },
|
625 | 705 | {
|
|
666 | 746 | " plt.legend()\n",
|
667 | 747 | " plt.show()\n",
|
668 | 748 | "\n",
|
669 |
| - "plot_life_expectancy(df, countries)" |
| 749 | + "plot_life_expectancy(df, country_list)" |
670 | 750 | ]
|
671 | 751 | },
|
672 | 752 | {
|
|
0 commit comments