Skip to content

Commit

Permalink
update with object Categoricals
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeubank committed Dec 7, 2023
1 parent fd82721 commit 94ccc38
Show file tree
Hide file tree
Showing 390 changed files with 13,709 additions and 2,960 deletions.
Binary file modified _build/.doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified _build/.doctrees/notebooks/class_3/week_2/10_pandas_series.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified _build/.doctrees/notebooks/class_3/week_3/40_EX_cleaning.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion _build/html/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="notebooks/class_3/week_3/10_views_and_copies_numpy_review.html">Views and Copies in Pandas</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-7"><i class="fa-solid fa-chevron-down"></i></label><ul>
<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/15_views_and_copies_in_pandas.html">Views and Copies in pandas</a></li>

<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/17_views_and_copies_in_pandas_wo_CoW.html">The View/Copy Headache in pandas without Copy on Write</a></li>
</ul>
</li>
Expand All @@ -238,6 +237,7 @@
<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/32_cleaning_editing_specific_locations.html">Editing Specific Locations</a></li>
<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/33_cleaning_datatypes.html">Cleaning Data Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/35_cleaning_missing_data.html">Missing Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="notebooks/class_3/week_3/37_object_and_categorical_dtypes.html">The Object and Categorical Data Types</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="notebooks/class_3/week_4/00_intro_to_querying_data.html">Data Manipulations</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" type="checkbox"/><label class="toctree-toggle" for="toctree-checkbox-10"><i class="fa-solid fa-chevron-down"></i></label><ul>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"years_of_education = [12, 16, 11, 22, 12, 8, 12]\n",
"\n",
"survey = np.array([incomes, ages, years_of_education]).T\n",
"survey\n"
"survey"
]
},
{
Expand Down Expand Up @@ -78,7 +78,7 @@
],
"source": [
"mean_age = np.mean(survey[:, 1])\n",
"np.round(mean_age, 1)\n"
"np.round(mean_age, 1)"
]
},
{
Expand Down Expand Up @@ -140,7 +140,7 @@
],
"source": [
"mean_income = np.mean(survey[:, 0])\n",
"mean_income\n"
"mean_income"
]
},
{
Expand All @@ -160,7 +160,7 @@
}
],
"source": [
"np.round(mean_income, 1)\n"
"np.round(mean_income, 1)"
]
},
{
Expand Down Expand Up @@ -241,12 +241,12 @@
],
"source": [
"survey[survey[:, 0] < 20_000, 0] = survey[survey[:, 0] < 20_000, 0] + 1_500\n",
"survey\n"
"survey"
]
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -255,13 +255,13 @@
"40214.3"
]
},
"execution_count": 27,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.round(np.mean(survey[:, 0]), 1)\n"
"np.round(np.mean(survey[:, 0]), 1)"
]
},
{
Expand Down Expand Up @@ -325,7 +325,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand All @@ -334,7 +334,7 @@
"(122603, 5)"
]
},
"execution_count": 11,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -346,28 +346,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"26.0"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hourly = cps[:, 0] / cps[:, 1]\n",
"np.round(np.mean(hourly), 1)\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 32,
"metadata": {},
"outputs": [
{
Expand All @@ -376,19 +355,19 @@
"27.883329990399556"
]
},
"execution_count": 13,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"men = np.mean(hourly[cps[:, 2] == 1])\n",
"men\n"
"men"
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 33,
"metadata": {},
"outputs": [
{
Expand All @@ -397,18 +376,18 @@
"27.9"
]
},
"execution_count": 14,
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.round(men, 1)\n"
"np.round(men, 1)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 34,
"metadata": {},
"outputs": [
{
Expand All @@ -417,19 +396,19 @@
"23.803157653012704"
]
},
"execution_count": 15,
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"women = np.mean(hourly[cps[:, 2] == 2])\n",
"women\n"
"women"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 35,
"metadata": {},
"outputs": [
{
Expand All @@ -438,18 +417,18 @@
"23.8"
]
},
"execution_count": 16,
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.round(women, 1)\n"
"np.round(women, 1)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 36,
"metadata": {},
"outputs": [
{
Expand All @@ -458,18 +437,18 @@
"0.8536698328789393"
]
},
"execution_count": 17,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"women / men\n"
"women / men"
]
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 37,
"metadata": {},
"outputs": [
{
Expand All @@ -478,13 +457,13 @@
"0.854"
]
},
"execution_count": 18,
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.round(women / men, 3)\n"
"np.round(women / men, 3)"
]
},
{
Expand Down Expand Up @@ -518,7 +497,7 @@
],
"source": [
"black = np.mean(hourly[cps[:, 3] == 2])\n",
"black\n"
"black"
]
},
{
Expand All @@ -538,7 +517,7 @@
}
],
"source": [
"np.round(black, 1)\n"
"np.round(black, 1)"
]
},
{
Expand All @@ -559,7 +538,7 @@
],
"source": [
"white = np.mean(hourly[cps[:, 3] == 1])\n",
"white\n"
"white"
]
},
{
Expand All @@ -579,7 +558,7 @@
}
],
"source": [
"np.round(white, 1)\n"
"np.round(white, 1)"
]
},
{
Expand All @@ -599,7 +578,7 @@
}
],
"source": [
"black / white\n"
"black / white"
]
},
{
Expand All @@ -619,7 +598,7 @@
}
],
"source": [
"np.round(black / white, 3)\n"
"np.round(black / white, 3)"
]
},
{
Expand Down Expand Up @@ -651,7 +630,7 @@
"metadata": {},
"outputs": [],
"source": [
"true_average = np.sum((hourly * cps[:, 4]) / np.sum(cps[:, 4]))\n"
"true_average = np.sum((hourly * cps[:, 4]) / np.sum(cps[:, 4]))"
]
},
{
Expand All @@ -671,7 +650,7 @@
}
],
"source": [
"np.round(true_average, 2)\n"
"np.round(true_average, 2)"
]
}
],
Expand All @@ -691,7 +670,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.11.4"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
Loading

0 comments on commit 94ccc38

Please sign in to comment.