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.
ML-For-Beginners/2-Regression/2-Data/solution/notebook.ipynb

427 lines
28 KiB

4 years ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Linear Regression for Pumpkins - Lesson 2"
]
},
4 years ago
{
"cell_type": "code",
"execution_count": 2,
4 years ago
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>City Name</th>\n",
" <th>Type</th>\n",
" <th>Package</th>\n",
" <th>Variety</th>\n",
" <th>Sub Variety</th>\n",
" <th>Grade</th>\n",
" <th>Date</th>\n",
" <th>Low Price</th>\n",
" <th>High Price</th>\n",
" <th>Mostly Low</th>\n",
" <th>...</th>\n",
" <th>Unit of Sale</th>\n",
" <th>Quality</th>\n",
" <th>Condition</th>\n",
" <th>Appearance</th>\n",
" <th>Storage</th>\n",
" <th>Crop</th>\n",
" <th>Repack</th>\n",
" <th>Trans Mode</th>\n",
" <th>Unnamed: 24</th>\n",
" <th>Unnamed: 25</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>70</th>\n",
" <td>BALTIMORE</td>\n",
" <td>NaN</td>\n",
" <td>1 1/9 bushel cartons</td>\n",
" <td>PIE TYPE</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>9/24/16</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>BALTIMORE</td>\n",
" <td>NaN</td>\n",
" <td>1 1/9 bushel cartons</td>\n",
" <td>PIE TYPE</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>9/24/16</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>72</th>\n",
" <td>BALTIMORE</td>\n",
" <td>NaN</td>\n",
" <td>1 1/9 bushel cartons</td>\n",
" <td>PIE TYPE</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>10/1/16</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>18.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>73</th>\n",
" <td>BALTIMORE</td>\n",
" <td>NaN</td>\n",
" <td>1 1/9 bushel cartons</td>\n",
" <td>PIE TYPE</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>10/1/16</td>\n",
" <td>17.0</td>\n",
" <td>17.0</td>\n",
" <td>17.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74</th>\n",
" <td>BALTIMORE</td>\n",
" <td>NaN</td>\n",
" <td>1 1/9 bushel cartons</td>\n",
" <td>PIE TYPE</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>10/8/16</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>15.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 26 columns</p>\n",
"</div>"
],
4 years ago
"text/plain": [
" City Name Type Package Variety Sub Variety Grade \\\n",
"70 BALTIMORE NaN 1 1/9 bushel cartons PIE TYPE NaN NaN \n",
"71 BALTIMORE NaN 1 1/9 bushel cartons PIE TYPE NaN NaN \n",
"72 BALTIMORE NaN 1 1/9 bushel cartons PIE TYPE NaN NaN \n",
"73 BALTIMORE NaN 1 1/9 bushel cartons PIE TYPE NaN NaN \n",
"74 BALTIMORE NaN 1 1/9 bushel cartons PIE TYPE NaN NaN \n",
"\n",
" Date Low Price High Price Mostly Low ... Unit of Sale Quality \\\n",
"70 9/24/16 15.0 15.0 15.0 ... NaN NaN \n",
"71 9/24/16 18.0 18.0 18.0 ... NaN NaN \n",
"72 10/1/16 18.0 18.0 18.0 ... NaN NaN \n",
"73 10/1/16 17.0 17.0 17.0 ... NaN NaN \n",
"74 10/8/16 15.0 15.0 15.0 ... NaN NaN \n",
"\n",
" Condition Appearance Storage Crop Repack Trans Mode Unnamed: 24 \\\n",
"70 NaN NaN NaN NaN N NaN NaN \n",
"71 NaN NaN NaN NaN N NaN NaN \n",
"72 NaN NaN NaN NaN N NaN NaN \n",
"73 NaN NaN NaN NaN N NaN NaN \n",
"74 NaN NaN NaN NaN N NaN NaN \n",
"\n",
" Unnamed: 25 \n",
"70 NaN \n",
"71 NaN \n",
"72 NaN \n",
"73 NaN \n",
"74 NaN \n",
"\n",
"[5 rows x 26 columns]"
]
4 years ago
},
"execution_count": 2,
4 years ago
"metadata": {},
"output_type": "execute_result"
4 years ago
}
],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"pumpkins = pd.read_csv('../../data/US-pumpkins.csv')\n",
4 years ago
"\n",
"pumpkins = pumpkins[pumpkins['Package'].str.contains('bushel', case=True, regex=True)]\n",
"\n",
"pumpkins.head()"
]
},
{
"cell_type": "code",
"execution_count": 3,
4 years ago
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"City Name 0\n",
"Type 406\n",
"Package 0\n",
"Variety 0\n",
"Sub Variety 167\n",
"Grade 415\n",
"Date 0\n",
"Low Price 0\n",
"High Price 0\n",
"Mostly Low 24\n",
"Mostly High 24\n",
"Origin 0\n",
"Origin District 396\n",
"Item Size 114\n",
"Color 145\n",
4 years ago
"Environment 415\n",
"Unit of Sale 404\n",
"Quality 415\n",
"Condition 415\n",
"Appearance 415\n",
"Storage 415\n",
"Crop 415\n",
"Repack 0\n",
"Trans Mode 415\n",
"Unnamed: 24 415\n",
"Unnamed: 25 391\n",
"dtype: int64"
]
},
"execution_count": 3,
4 years ago
"metadata": {},
"output_type": "execute_result"
4 years ago
}
],
"source": [
"pumpkins.isnull().sum()"
]
},
{
"cell_type": "code",
"execution_count": 4,
4 years ago
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
4 years ago
"text": [
" Month Package Low Price High Price Price\n",
"70 9 1 1/9 bushel cartons 15.00 15.0 13.50\n",
"71 9 1 1/9 bushel cartons 18.00 18.0 16.20\n",
"72 10 1 1/9 bushel cartons 18.00 18.0 16.20\n",
"73 10 1 1/9 bushel cartons 17.00 17.0 15.30\n",
"74 10 1 1/9 bushel cartons 15.00 15.0 13.50\n",
"... ... ... ... ... ...\n",
"1738 9 1/2 bushel cartons 15.00 15.0 30.00\n",
"1739 9 1/2 bushel cartons 13.75 15.0 28.75\n",
"1740 9 1/2 bushel cartons 10.75 15.0 25.75\n",
"1741 9 1/2 bushel cartons 12.00 12.0 24.00\n",
"1742 9 1/2 bushel cartons 12.00 12.0 24.00\n",
"\n",
"[415 rows x 5 columns]\n"
4 years ago
]
}
],
"source": [
"\n",
"# A set of new columns for a new dataframe. Filter out nonmatching columns\n",
"new_columns = ['Package', 'Month', 'Low Price', 'High Price', 'Date']\n",
"pumpkins = pumpkins.drop([c for c in pumpkins.columns if c not in new_columns], axis=1)\n",
"\n",
"# Get an average between low and high price for the base pumpkin price\n",
"price = (pumpkins['Low Price'] + pumpkins['High Price']) / 2\n",
"\n",
"# Convert the date to its month only\n",
"month = pd.DatetimeIndex(pumpkins['Date']).month\n",
"\n",
"# Create a new dataframe with this basic data\n",
"new_pumpkins = pd.DataFrame({'Month': month, 'Package': pumpkins['Package'], 'Low Price': pumpkins['Low Price'],'High Price': pumpkins['High Price'], 'Price': price})\n",
"\n",
"# Convert the price if the Package contains fractional bushel values\n",
"new_pumpkins.loc[new_pumpkins['Package'].str.contains('1 1/9'), 'Price'] = price/(1 + 1/9)\n",
4 years ago
"\n",
"new_pumpkins.loc[new_pumpkins['Package'].str.contains('1/2'), 'Price'] = price/(1/2)\n",
4 years ago
"\n",
"print(new_pumpkins)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
4 years ago
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAcXklEQVR4nO3dfZRcdZ3n8fdnKg80GbAJdL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PRmZjnnoDczyzkHvZlZzjnozcxyzkFvZpZzDnozs5xz0JuZ5ZyD3sws5xz0ZmY556A3M8s5B72ZWc456M3Mcs5Bb2aWcw56M7Oca3rjEQBJdwBvBw5HxHlJ22zgM8BC4CDwbyPihTrLXgnckDy9KSLuzF72WKtveYDHD794/PniObPYdc0qAHbsHWLrzgMcOjrCvP4+Nq1ZwoZlg22tr9bBLevHrDvtDun1TBM8cfN6Lr/tIb765JHj7SsXzeauqy5saR3LN+/i+Z+8dPz53NNmsPv61Q33o7pf8mThtfeOaasco6zLvuaDX+LHvxg9/vz0mQUeuXEt0HxsNVp3s+22u+xgf19LY/yGHfvZvvsZRiMoSFy2fD43bWjtHkHnXnvvCeNcwFPj1M/dcrK8Jqoponk8SboI+Cnwyaqg/wvgSERskXQtcEZE/EnNcrOBElAEAtgDvK7eD4RqxWIxSqVSyzuRFsqL58zi6jct5rq79zNy7Fcv1L7pBW6+ZGnqC6FZyFfc+s7zx6x7PLQS9rUhX1Ed9o36JU8Du16AVDQLkmbL1oZ8xekzC/z5hqUNx1ajdTdycMv6jpetV0e1G3bs51MPPz1m/itWLGga9rUhX9F
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
4 years ago
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
4 years ago
}
],
"source": [
"\n",
"price = new_pumpkins.Price\n",
"month = new_pumpkins.Month\n",
"plt.scatter(price, month)\n",
"plt.show()\n"
4 years ago
]
},
{
"cell_type": "code",
"execution_count": 6,
4 years ago
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0, 0.5, 'Pumpkin Price')"
]
},
"execution_count": 6,
4 years ago
"metadata": {},
"output_type": "execute_result"
4 years ago
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEJCAYAAACT/UyFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAA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ttMf/y61PFjnE82HgqFnz1gOXVNUBwCXdtCRpghYq/qclubN73AUcvPV5kju398FVdRkw+768L2Y0hET389jFhJYkLd68Qz1VtUsP61tRVTd3z38CrOhhHZKkBSzmBK6doqqK6fMDttFdCnpTkk1btmyZYDJJemCbdPHfkmRfgO7nrfO9sKo2VtXaqlo7NTU1sYCS9EA36eI/Hzixe34icN6E1y9Jzeut+JN8FPh34MAkNyb5Y2AD8Lwk1wFHdtOSpAka55INi1JVJ8yz6Ii+1ilJ2r7BvtyVJA3D4pekxlj8ktQYi1+SGmPxS1JjLH5JaozFL0mNsfglqTEWvyQ1xuKXpMZY/JLUGItfkhpj8UtSYyx+SWqMxS9JjbH4JakxFr8kNcbil6TGWPyS1BiLX5IaY/FLUmMsfklqjMUvSY2x+CWpMRa/JDXG4pekxlj8ktSYXYdYaZIbgLuAe4F7qmrtEDkkqUWDFH/nOVV124Drl6QmOdQjSY0ZqvgL+FySK5KsGyiDJDVpqKGeZ1XVTUkeA3w+yXer6rKZL+h+IawDWLly5RAZJekBaZA9/qq6qft5K/Bp4NA5XrOxqtZW1dqpqalJR5SkB6yJF3+ShyfZc+tz4PnA1ZPOIUmtGmKoZwXw6SRb139OVX1mgByS1KSJF39VXQ88bdLrlSSNeDinJDXG4pekxlj8ktQYi1+SGmPxS1JjLH5
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
4 years ago
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
4 years ago
}
],
"source": [
"\n",
"new_pumpkins.groupby(['Month'])['Price'].mean().plot(kind='bar')\n",
"plt.ylabel(\"Pumpkin Price\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
},
"kernelspec": {
"display_name": "Python 3.7.0 64-bit ('3.7')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
},
"metadata": {
"interpreter": {
"hash": "70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d"
}
},
"orig_nbformat": 2
},
"nbformat": 4,
"nbformat_minor": 2
}