Skip to content

Commit 306ad68

Browse files
committed
fix issues
1 parent 6e838a9 commit 306ad68

9 files changed

+2375
-101
lines changed

data/.DS_Store

6 KB
Binary file not shown.

lessons/.ipynb_checkpoints/1_Functions_and_Conditionals-checkpoint.ipynb

Lines changed: 753 additions & 0 deletions
Large diffs are not rendered by default.

lessons/.ipynb_checkpoints/2_Iteration_and_Visualization-checkpoint.ipynb

Lines changed: 721 additions & 0 deletions
Large diffs are not rendered by default.

lessons/.ipynb_checkpoints/3_Project-checkpoint.ipynb

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

lessons/1_Functions_and_Conditionals.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@
745745
"name": "python",
746746
"nbconvert_exporter": "python",
747747
"pygments_lexer": "ipython3",
748-
"version": "3.8.13"
748+
"version": "3.11.7"
749749
}
750750
},
751751
"nbformat": 4,

lessons/2_Iteration_and_Visualization.ipynb

Lines changed: 12 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
"metadata": {},
159159
"outputs": [],
160160
"source": [
161-
"numbers = [12, 20, 43, 88, 97, 100, 105, 110]\n",
161+
"numbers = [12, 20.2, 43, 88.88, 97, 100, 105, 110.9167]\n",
162162
"\n",
163163
"for number in numbers:\n",
164164
" if number > 100:\n",
@@ -185,7 +185,7 @@
185185
" \n",
186186
"The result of this is a single list, number, or string with a summary value for the entire collection being looped over.\n",
187187
"\n",
188-
"Returning to the tire pressure example, we can make a new list with all of the tire pressures rounded:"
188+
"We can make a new list with all of the rounded numbers:"
189189
]
190190
},
191191
{
@@ -298,95 +298,13 @@
298298
},
299299
{
300300
"cell_type": "code",
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",
301+
"execution_count": null,
302+
"metadata": {},
303+
"outputs": [],
304+
"source": [
305+
"import pandas as pd\n",
306+
"\n",
307+
"df = pd.read_csv('../data/gapminder_gni.csv')\n",
390308
"df.head()"
391309
]
392310
},
@@ -735,6 +653,8 @@
735653
"metadata": {},
736654
"outputs": [],
737655
"source": [
656+
"import matplotlib.pyplot as plt\n",
657+
"\n",
738658
"# YOUR CODE HERE\n",
739659
"\n",
740660
"country_list = [..., ..., ...]\n",
@@ -793,7 +713,7 @@
793713
"name": "python",
794714
"nbconvert_exporter": "python",
795715
"pygments_lexer": "ipython3",
796-
"version": "3.8.13"
716+
"version": "3.11.7"
797717
}
798718
},
799719
"nbformat": 4,

lessons/3_Project.ipynb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"source": [
132132
"## Locating the Data\n",
133133
"\n",
134-
"Try to locate the files in the \"chis_data\" folder, which is in the \"data\" folder, which is in the main \"Python-Fundamentals\" folder. Using `pd.read_csv()`, read in all three data frames and assign them to the three variables defined below.\n",
134+
"Try to locate the files in the \"chis_data\" folder, which is in the \"data\" folder, which is in the main \"Python-Intermediate\" folder. Using `pd.read_csv()`, read in all three data frames and assign them to the three variables defined below.\n",
135135
"\n",
136136
"💡 **Tip**: You can use Jupyter Lab's File Browser to the left of your screen to get a sense of where the \"chis_data\" folder is.\n",
137137
"\n",
@@ -194,6 +194,17 @@
194194
"# YOUR CODE HERE\n"
195195
]
196196
},
197+
{
198+
"cell_type": "code",
199+
"execution_count": null,
200+
"metadata": {},
201+
"outputs": [],
202+
"source": [
203+
"# Let's reset the index\n",
204+
"df.reset_index(drop=True)\n",
205+
"df"
206+
]
207+
},
197208
{
198209
"cell_type": "markdown",
199210
"metadata": {},
@@ -270,12 +281,14 @@
270281
"source": [
271282
"## Creating a Function\n",
272283
"\n",
273-
"It turns out that poverty is expressed \"as Times of 100% Federal Poverty Line (FPL)\". One approach to this could be to see if we can find differences in general health for people **below and above the poverty line**. \n",
284+
"It turns out that poverty is expressed \"as Times of 100% Federal Poverty Line (FPL)\".\n",
285+
"For instance, `\"100-199%\" FPL\"` means that the row's income was 1-1.99 times the FPL.\n",
286+
"One approach to this statistic could be to see if we can find differences in general health for people **below and above the poverty line**. \n",
274287
"\n",
275288
"To do this, we can create a function that takes in values of the `poverty_level` column and outputs whether that value is above or below the poverty line.\n",
276289
"\n",
277290
"1. Create a new function called `assign_level`. It takes one parameter, which we'll call `i`.\n",
278-
"2. If `i` is `0-99% FPL`, return 0. In all other cases, return 1."
291+
"2. If `i` is `\"0-99% FPL\"`, return 0. In all other cases, return 1."
279292
]
280293
},
281294
{
@@ -429,7 +442,7 @@
429442
"name": "python",
430443
"nbconvert_exporter": "python",
431444
"pygments_lexer": "ipython3",
432-
"version": "3.8.13"
445+
"version": "3.11.7"
433446
}
434447
},
435448
"nbformat": 4,

0 commit comments

Comments
 (0)