Skip to content

Instantly share code, notes, and snippets.

@rebeccabilbro
Created November 23, 2014 20:45
Show Gist options
  • Save rebeccabilbro/6f7bb49bd09a53c00a93 to your computer and use it in GitHub Desktop.
Save rebeccabilbro/6f7bb49bd09a53c00a93 to your computer and use it in GitHub Desktop.
Colonials Project Sample with IPython
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:17a326c937d69c3751bd96853948bef17b4b42f949c53685b59e7e61bd1f5755"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Team Colonials"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Final Project Presentation\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Awilda Lopez, Bala Venkatesan, Faith Bradley, Rebecca Bilbro"
]
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"Cohort 2, Fall 2014\n",
"\n"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Problem:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"In the first three decades after OSHA was created in 1971, workplace fatalities dropped more than 65%, even as US employment doubled. Now worker deaths are down from about 38 a day in 1970 to 12 a day in 2013. \n",
"\n",
"But we've hit a plateau.\n",
"\n",
"OSHA's budget is small and not likely to increase. The agency can only do so much outreach, training, enforcement, and standard-setting. \n",
"\n",
"How can the agency make the most of its limited resources? "
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Goal:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"Use OSHA data to build a tool that will help the agency develop targeting schemas for outreach, training, enforcement, and regulation."
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Hypotheses:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"1. Industries are changing - while hazards may be decreasing in some traditional industries (traditional manufacturing?), more workers are being killed in new industries (green energy?).\n"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"2. Variation by state - maybe fewer workers are being killed in State X while more workers are being killed in State Y.\n"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"3. Impact of the recession\n"
]
},
{
"cell_type": "heading",
"level": 6,
"metadata": {},
"source": [
" a. The recession has depressed the number of worker fatalities, artificially diminishing the impact of hazardous workplaces."
]
},
{
"cell_type": "heading",
"level": 6,
"metadata": {},
"source": [
" b. There are fewer fatalities in construction because of the housing market collapse."
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"4. Time of year - much of the most hazardous work is seasonal.\n"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"5. Area offices - certain field offices are more effective than others."
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Data:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"The primary data sources are the OSHA website (http://www.osha.gov) and the Department of Labor Enforcement Data Catalog (http://ogesdw.dol.gov/). So what does that data look like?"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import pandas as pd\n",
"import matplotlib"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"oshadata = pd.read_csv(\"deaths.csv\", index_col=\"year\")\n",
"oshadata[:5]\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>event_date</th>\n",
" <th>state</th>\n",
" <th>report_id</th>\n",
" <th>summary_nr</th>\n",
" <th>event_desc</th>\n",
" <th>event_keyword</th>\n",
" <th>fatality</th>\n",
" <th>sic_list</th>\n",
" </tr>\n",
" <tr>\n",
" <th>year</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1990</th>\n",
" <td> 07-13-1990</td>\n",
" <td> ALABAMA</td>\n",
" <td> 418300</td>\n",
" <td> 593681</td>\n",
" <td> Employee falls, dies of massive head injuries</td>\n",
" <td> FALL,STORAGE RACK,HEAD</td>\n",
" <td> True</td>\n",
" <td> 4213</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1991</th>\n",
" <td> 08-27-1991</td>\n",
" <td> ALABAMA</td>\n",
" <td> 418300</td>\n",
" <td> 602524</td>\n",
" <td> ELECTRIC SHOCK - DIRECT CONTACT WITH ENERGIZED...</td>\n",
" <td> ELECTRICAL,ELECTROCUTED,RUNWAY CONDUCTOR,ELECT...</td>\n",
" <td> True</td>\n",
" <td> 3471</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1991</th>\n",
" <td> 09-17-1991</td>\n",
" <td> ALABAMA</td>\n",
" <td> 418300</td>\n",
" <td> 602532</td>\n",
" <td> Employee is run over and killed by runaway loader</td>\n",
" <td> RUN OVER,FRONT END LOADER,LOST CONTROL,CONSTRU...</td>\n",
" <td> True</td>\n",
" <td> 1794</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1991</th>\n",
" <td> 08-28-1991</td>\n",
" <td> ALABAMA</td>\n",
" <td> 418300</td>\n",
" <td> 602540</td>\n",
" <td> CONSTRUCTION EMPLOYEE KILLED IN A FLASH FIRE</td>\n",
" <td> CONSTRUCTION,FIRE,BURN,FLAMMABLE VAPORS,NAPHTH...</td>\n",
" <td> True</td>\n",
" <td> 1752</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1991</th>\n",
" <td> 09-26-1991</td>\n",
" <td> ALABAMA</td>\n",
" <td> 418300</td>\n",
" <td> 602565</td>\n",
" <td> Employee killed, others exposed to CO2 during ...</td>\n",
" <td> CARBON DIOXIDE,OVEREXPOSURE,FIRE</td>\n",
" <td> True</td>\n",
" <td> 1540</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"text": [
" event_date state report_id summary_nr \\\n",
"year \n",
"1990 07-13-1990 ALABAMA 418300 593681 \n",
"1991 08-27-1991 ALABAMA 418300 602524 \n",
"1991 09-17-1991 ALABAMA 418300 602532 \n",
"1991 08-28-1991 ALABAMA 418300 602540 \n",
"1991 09-26-1991 ALABAMA 418300 602565 \n",
"\n",
" event_desc \\\n",
"year \n",
"1990 Employee falls, dies of massive head injuries \n",
"1991 ELECTRIC SHOCK - DIRECT CONTACT WITH ENERGIZED... \n",
"1991 Employee is run over and killed by runaway loader \n",
"1991 CONSTRUCTION EMPLOYEE KILLED IN A FLASH FIRE \n",
"1991 Employee killed, others exposed to CO2 during ... \n",
"\n",
" event_keyword fatality sic_list \n",
"year \n",
"1990 FALL,STORAGE RACK,HEAD True 4213 \n",
"1991 ELECTRICAL,ELECTROCUTED,RUNWAY CONDUCTOR,ELECT... True 3471 \n",
"1991 RUN OVER,FRONT END LOADER,LOST CONTROL,CONSTRU... True 1794 \n",
"1991 CONSTRUCTION,FIRE,BURN,FLAMMABLE VAPORS,NAPHTH... True 1752 \n",
"1991 CARBON DIOXIDE,OVEREXPOSURE,FIRE True 1540 "
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"Yeah, but what does it LOOK like?"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"oshadata = oshadata[[\"state\", \"report_id\", \"sic_list\"]]\n"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"oshadata.plot()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"text": [
"<matplotlib.axes.AxesSubplot at 0x1195b0c90>"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Analysis:"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Interpretations:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"(to be added later)"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"The Conclusions:"
]
},
{
"cell_type": "heading",
"level": 5,
"metadata": {},
"source": [
"(to be added later)"
]
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment