Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2,199 changes: 2,199 additions & 0 deletions Jeff - Exercises-1.ipynb

Large diffs are not rendered by default.

1,380 changes: 1,380 additions & 0 deletions Jeff - Exercises-2.ipynb

Large diffs are not rendered by default.

646 changes: 646 additions & 0 deletions Jeff - Exercises-3.ipynb

Large diffs are not rendered by default.

739 changes: 739 additions & 0 deletions Jeff - Exercises-4.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# American Time Use Analysis

## Description

Use the U.S. Department of Labor's data on Americans' time use for research and analysis.
Expand Down
142 changes: 42 additions & 100 deletions Starting Point.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 1,
"metadata": {
"collapsed": false
},
Expand All @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 2,
"metadata": {
"collapsed": false
},
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 3,
"metadata": {
"collapsed": false
},
Expand All @@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 4,
"metadata": {
"collapsed": false
},
Expand All @@ -60,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 5,
"metadata": {
"collapsed": false
},
Expand All @@ -76,7 +76,7 @@
" dtype='object', length=413)"
]
},
"execution_count": 31,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -101,15 +101,15 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
Expand Down Expand Up @@ -210,96 +210,42 @@
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>20130101130611</td>\n",
" <td>7731257.992805</td>\n",
" <td>-1</td>\n",
" <td>50</td>\n",
" <td>2</td>\n",
" <td>40</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>...</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>20130101130616</td>\n",
" <td>4725269.227067</td>\n",
" <td>-1</td>\n",
" <td>45</td>\n",
" <td>2</td>\n",
" <td>40</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>...</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 413 columns</p>\n",
"<p>3 rows × 413 columns</p>\n",
"</div>"
],
"text/plain": [
" tucaseid TUFINLWGT TRYHHCHILD TEAGE TESEX PEEDUCA \\\n",
"0 20130101130004 11899905.662034 12 22 2 40 \n",
"1 20130101130112 4447638.009513 1 39 1 43 \n",
"2 20130101130123 10377056.507734 -1 47 2 40 \n",
"3 20130101130611 7731257.992805 -1 50 2 40 \n",
"4 20130101130616 4725269.227067 -1 45 2 40 \n",
"\n",
" PTDTRACE PEHSPNON GTMETSTA TELFS ... t181501 t181599 t181601 \\\n",
"0 8 2 1 5 ... 0 0 0 \n",
"1 1 2 1 1 ... 0 0 0 \n",
"2 1 2 1 4 ... 25 0 0 \n",
"3 1 1 1 1 ... 0 0 0 \n",
"4 2 2 1 1 ... 0 0 0 \n",
"\n",
" t181801 t189999 t500101 t500103 t500105 t500106 t500107 \n",
"0 0 0 0 0 0 0 0 \n",
"1 0 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 0 0 \n",
"\n",
"[5 rows x 413 columns]"
"[3 rows x 413 columns]"
]
},
"execution_count": 32,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summary.head()"
"summary.head(3)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 11,
"metadata": {
"collapsed": false
},
Expand All @@ -311,7 +257,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 12,
"metadata": {
"collapsed": false
},
Expand All @@ -335,7 +281,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 13,
"metadata": {
"collapsed": false
},
Expand All @@ -359,7 +305,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 14,
"metadata": {
"collapsed": false
},
Expand All @@ -383,15 +329,15 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
Expand Down Expand Up @@ -439,7 +385,7 @@
"6 5671341.270490 244"
]
},
"execution_count": 37,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -463,69 +409,63 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>weight</th>\n",
" <th>minutes</th>\n",
" <th>weighted_minutes</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10377056.507734</td>\n",
" <td>60</td>\n",
" <td>6.226234e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>7731257.992805</td>\n",
" <td>65</td>\n",
" <td>5.025318e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4725269.227067</td>\n",
" <td>90</td>\n",
" <td>4.252742e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>2372791.046351</td>\n",
" <td>270</td>\n",
" <td>6.406536e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>5671341.270490</td>\n",
" <td>244</td>\n",
" <td>1.383807e+09</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" weight minutes weighted_minutes\n",
"2 10377056.507734 60 6.226234e+08\n",
"3 7731257.992805 65 5.025318e+08\n",
"4 4725269.227067 90 4.252742e+08\n",
"5 2372791.046351 270 6.406536e+08\n",
"6 5671341.270490 244 1.383807e+09"
" weight minutes\n",
"2 10377056.507734 60\n",
"3 7731257.992805 65\n",
"4 4725269.227067 90\n",
"5 2372791.046351 270\n",
"6 5671341.270490 244"
]
},
"execution_count": 39,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -536,7 +476,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 17,
"metadata": {
"collapsed": false
},
Expand All @@ -547,7 +487,7 @@
"211.67427866070051"
]
},
"execution_count": 40,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -559,20 +499,22 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"190.25402840855642"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
"ename": "AttributeError",
"evalue": "'DataFrame' object has no attribute 'weighted_minutes'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-18-a3d2cfe04470>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Minutes on average spent watching TV (weighted)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweighted_minutes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweight\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/Users/jeffreyhacker/Documents/Python/Iron_Yard/homework/atus-analysis/.direnv/python-3.4.3/lib/python3.4/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 2148\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2149\u001b[0m raise AttributeError(\"'%s' object has no attribute '%s'\" %\n\u001b[0;32m-> 2150\u001b[0;31m (type(self).__name__, name))\n\u001b[0m\u001b[1;32m 2151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2152\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__setattr__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'DataFrame' object has no attribute 'weighted_minutes'"
]
}
],
"source": [
Expand All @@ -582,7 +524,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 19,
"metadata": {
"collapsed": false
},
Expand Down
Loading