Last active
July 12, 2019 00:33
-
-
Save fijiaaron/e64e4fd260e8085e1f272a68398923c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nsfg | |
df = nsfg.ReadFemPreg() | |
def first_babies(df): | |
for index, row in df.iterrows(): | |
if row.prgoutcome == 1: # only report on live births | |
print(index, row.caseid, row.prgoutcome, row.pregordr, row.birthord, row.wksgest) | |
first_babies(df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create the file
first_babies.py
in your ThinkStats2/code directory.Run it from the terminal with the command
python first_babies.py
It currently prints information for all babies born alive.
Assignment: Make it print only the first born babies.
Bonus: return the total number of first born babies