{ "metadata": { "name": "", "signature": "sha256:34edac0b3e1a43c301918a55e631134295e3b2dcb4ea03f7b45bb274ad69aff1" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "#apply styles to notebook (rather than doing it locally \n", "# via the profile custom.css file)\n", "#from IPython.core.display import HTML\n", "#css_file = 'media/style.css'\n", "#HTML(open(css_file, \"r\").read())" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "#U.S. Federal Contracts \n", "![Federal Contracts](media/fedcontracts.jpg \"Federal Contracts\")" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "import pandas as pd\n", "import seaborn as sns\n", "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Data Notes \n", "* Source: [USASpending.gov](http://usaspending.gov \"USASpending.gov\")\n", "* Full 08-15-2014 contract archives for 2007 - 2013\n", "* Primary awards only\n", "* Aggregated by:\n", " * State (location of work)\n", " * Agency (primary contracting agency)\n", "* Inflation-adjusted using OMB's Budget Request deflators\n", "* Per-capita numbers calculated using vintage 2013 Census population estimates" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#read in aggregated federal contract totals\n", "contracts = pd.read_csv('data/fed_contract_totals.txt')\n", "contracts = contracts[[\n", " 'state_abbr', 'year', 'total_adj', 'dod_adj', \n", " 'non-dod_adj', 'total_per_capita_adj', 'dod_per_capita_adj',\n", " 'other_per_capita_adj', 'dod_percent_total', 'other_percent_total'\n", "]]\n", "#take a peek at the data\n", "contracts.head()" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
\n", " | state_abbr | \n", "year | \n", "total_adj | \n", "dod_adj | \n", "non-dod_adj | \n", "total_per_capita_adj | \n", "dod_per_capita_adj | \n", "other_per_capita_adj | \n", "dod_percent_total | \n", "other_percent_total | \n", "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "AK | \n", "2012 | \n", "2.566977e+09 | \n", "2.118944e+09 | \n", "4.480333e+08 | \n", "3514.933976 | \n", "2901.446238 | \n", "613.487738 | \n", "82.55 | \n", "17.45 | \n", "
1 | \n", "AK | \n", "2013 | \n", "1.678331e+09 | \n", "1.320963e+09 | \n", "3.573687e+08 | \n", "2283.037374 | \n", "1796.902746 | \n", "486.124303 | \n", "78.71 | \n", "21.29 | \n", "
2 | \n", "AK | \n", "2011 | \n", "2.412034e+09 | \n", "1.942390e+09 | \n", "4.696442e+08 | \n", "3334.420985 | \n", "2685.178076 | \n", "649.242909 | \n", "80.53 | \n", "19.47 | \n", "
3 | \n", "AK | \n", "2007 | \n", "2.672470e+09 | \n", "2.124680e+09 | \n", "5.477898e+08 | \n", "3928.365983 | \n", "3123.157060 | \n", "805.220247 | \n", "79.50 | \n", "20.50 | \n", "
4 | \n", "AK | \n", "2009 | \n", "3.086416e+09 | \n", "2.406223e+09 | \n", "6.801932e+08 | \n", "4416.142121 | \n", "3442.899441 | \n", "973.242680 | \n", "77.96 | \n", "22.04 | \n", "