Skip to content

Commit

Permalink
Updates and corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed Jun 14, 2024
2 parents c7b2d5f + da79f78 commit e1ffc57
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 1,642 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3,10']
python-version: ['3.10']

steps:
- uses: actions/checkout@v2
Expand All @@ -34,4 +34,3 @@ jobs:
- name: Run tests
run: |
make tests
45 changes: 38 additions & 7 deletions solutions/chap01soln.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Select the `birthord` column, print the value counts, and compare to results published in the [codebook](ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NSFG/Cycle6Codebook-Pregnancy.pdf)"
"Select the `birthord` column, print the value counts, and compare to results published in the [codebook](https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NSFG/Cycle6Codebook-Pregnancy.pdf)"
]
},
{
Expand Down Expand Up @@ -672,7 +672,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Select the `prglngth` column, print the value counts, and compare to results published in the [codebook](ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NSFG/Cycle6Codebook-Pregnancy.pdf)"
"Select the `prglngth` column, print the value counts, and compare to results published in the [codebook](https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NSFG/Cycle6Codebook-Pregnancy.pdf)"
]
},
{
Expand Down Expand Up @@ -1477,30 +1477,61 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"What was the birthweight of the first baby born to the respondent with `caseid` 5012?"
"What was the birthweight of the first baby born to the respondent with `caseid` 5013?"
]
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5515 6.0\n",
"5516 7.0\n",
"5517 NaN\n",
"5518 8.0\n",
"5519 8.0\n",
"Name: birthwgt_lb, dtype: float64"
]
},
"execution_count": 28,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Solution\n",
"\n",
"preg[preg.caseid==5012].birthwgt_lb"
"# One solution is the select all pregnancies with this `caseid` \n",
"# and assume that the first valid value is the birthweight of\n",
"# the first baby\n",
"preg[preg.caseid==5013].birthwgt_lb"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5516 7.0\n",
"Name: birthwgt_lb, dtype: float64"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Solution\n",
"\n",
"# A more complete solution uses `pregordr` to select the first baby\n",
"\n",
"preg[(preg.caseid==5013) & (preg.pregordr==1)].birthwgt_lb"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion solutions/chap04soln.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
"version": "3.8.16"
}
},
"nbformat": 4,
Expand Down
1,681 changes: 118 additions & 1,563 deletions solutions/chap05soln.ipynb

Large diffs are not rendered by default.

132 changes: 63 additions & 69 deletions solutions/chap08soln.ipynb

Large diffs are not rendered by default.

0 comments on commit e1ffc57

Please sign in to comment.