You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Data-Science-For-Beginners/2-Working-With-Data/08-data-preparation/assignment.ipynb

142 lines
22 KiB

{
"cells": [
{
"cell_type": "markdown",
"source": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"# Assignment: Evaluating Data from a Form\r\n",
"\r\n",
"A client has been testing a [small form](index.html) to gather some basic data about their client-base. They have brought their findings to you to validate the data they have gathered. You can open the `index.html` page in a browser to take a look at the form.\r\n",
"\r\n",
"You have been provided a [dataset of csv records](../../data/form.csv)that contain entries from the form as well as some basic visualizations.The client pointed out that some of the visualizations look incorrect but they're unsure about how to resolve them. You can explore it in the [assignment notebook](assignment.ipynb).\r\n",
"\r\n",
"## Instructions\r\n",
"\r\n",
"Use the techniques in this lesson to make recommendations about the form so it captures accurate and consistent information. "
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"!pip install pandas\r\n",
"!pip install matplotlib"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 4,
"source": [
"import pandas as pd\r\n",
"import matplotlib.pyplot as plt\r\n",
"\r\n",
"#Loading the dataset\r\n",
"path = '../../data/form.csv'\r\n",
"form_df = pd.read_csv(path)\r\n",
"print(form_df)"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
" birth_month state pet\n",
"0 January NaN Cats\n",
"1 JAN CA Cats\n",
"2 Sept Hawaii Dog\n",
"3 january AK Dog\n",
"4 July RI Cats\n",
"5 September California Cats\n",
"6 April CA Dog\n",
"7 January California Cats\n",
"8 November FL Dog\n",
"9 December Florida Cats\n"
]
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 7,
"source": [
"form_df['state'].value_counts().plot(kind='bar');\r\n",
"plt.show()"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEeCAYAAACExd7cAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bG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cBlw4iTrLwUu7UZxERExe02Cfh/gvo7lLXXbC0jaD1gEXNPR/FJJ6yTdKOmdE32IpGX1euu2bdvWoKyIiGii2wdjTwK+Yvvpjrb9bI8A7wM+JennxtvQ9grbI7ZHhoaGulxWRMSLV5Og3wos6Fjet24bz0mMGbaxvbV+3gx8k+eP30dExBxrEvRrgf0lLZK0K1WYv2D2jKRfAPYC/rGjbS9JL6lfzweOAG4du21ERMydKWfd2N4h6XTgamAesNL2LZKWA+tsj4b+ScBltt2x+RuAz0h6hupL5bzO2ToRETH3pgx6ANurgdVj2s4es/xH42x3A3DgLOqLiIhZypmxERGFS9BHRBQuQR8RUbgEfURE4RL0ERGFS9BHRBQuQR8RUbgEfURE4RL0ERGFS9BHRBQuQR8RUbgEfURE4RL0ERGFS9BHRBQuQR8RUbgEfURE4RL0ERGFaxT0kpZIukPSJklnjtP/m5K2SdpQP07r6DtV0l3149RuFh8REVOb8laCkuYBFwBvBbYAayWtGufer1+0ffqYbV8JnAOMAAbW19s+1JXqIyJiSk326A8DNtnebPsp4DLgxIbvfxywxvb2OtzXAEtmVmpERMxEk6DfB7ivY3lL3TbWr0u6WdJXJC2Y5rZIWiZpnaR127Zta1BWREQ00a2Dsf8ALLR9ENVe+8XTfQPbK2yP2B4ZGhrqUlkREdEk6LcCCzqW963bnmX7QdtP1ot/A/xi020jImJuNQn6tcD+khZJ2hU4CVjVuYK
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
}
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 8,
"source": [
"form_df['birth_month'].value_counts().plot(kind='bar');\r\n",
"plt.show()"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAElCAYAAADqeCmyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAA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Q01OOyIiK2XN0E/Upgz8bjPeq2TuYyqtvG9sr639uBH7N+/31EREywboJ+MbCPpL0lbUMV5o8bPSPp2cA04OeNtmmStq3vTweOAm4Z/dyIiJg44466sb1W0qnApcAUYIHtmyWdCSyxPRL6c4ELbLvx9H2BcyQ9QvWh8pHmaJ2IiJh44wY9gO1FwKJRbaePevzBDs+7Cth/M+qLiIjNlDNjIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIK11XQS5ot6VZJyySd1mH530laLem6+vamxrKTJd1W307uZfERETG+cS8lKGkKcDbwImAFsFjSwg7Xfv267VNHPXdn4AxgGDCwtH7uPT2pPiIixtXNHv2hwDLbt9t+GLgAmNPl678YuNz2mjrcLwdmb1qpERGxKboJ+t2B5Y3HK+q20V4j6QZJF0nacyOfi6R5kpZIWrJ69eouyoqIiG706mDsd4GZtg+g2mv/8sa+gO35todtDw8NDfWorIiI6CboVwJ7Nh7vUbc9yvbdth+qH34R+OtunxsREROrm6BfDOwjaW9J2wBzgYX
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
}
}
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [],
"metadata": {}
}
],
"metadata": {
"orig_nbformat": 4,
"language_info": {
"name": "python",
"version": "3.9.7",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.7 64-bit ('venv': venv)"
},
"interpreter": {
"hash": "6b9b57232c4b57163d057191678da2030059e733b8becc68f245de5a75abe84e"
}
},
"nbformat": 4,
"nbformat_minor": 2
}