mpg/eda.ipynb
2022-07-21 16:31:53 -04:00

2216 lines
74 KiB
Text

{
"cells": [
{
"cell_type": "markdown",
"id": "807a5642-e420-4208-9ccb-bcc442617ad0",
"metadata": {},
"source": [
"[Cleaning](clean.ipynb)"
]
},
{
"cell_type": "markdown",
"id": "04ed2aa6-7b64-4c2d-b007-594e31ecdae8",
"metadata": {},
"source": [
"# EDA"
]
},
{
"cell_type": "markdown",
"id": "682a6d42-8ce0-42fb-9892-b6a46beb0b9b",
"metadata": {},
"source": [
"Import and define some functions"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "5ffa8b01-0b17-4ad8-8e85-f2656da50c9e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:49.282341Z",
"iopub.status.busy": "2022-07-21T20:29:49.281981Z",
"iopub.status.idle": "2022-07-21T20:29:50.950452Z",
"shell.execute_reply": "2022-07-21T20:29:50.949681Z",
"shell.execute_reply.started": "2022-07-21T20:29:49.282260Z"
},
"tags": []
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"from os.path import exists\n",
"import matplotlib.pyplot as plt\n",
"from IPython.display import display, Markdown\n",
"\n",
"sns.set_theme(style='darkgrid')\n",
"\n",
"df = pd.read_csv('data/clean.csv')\n",
"y = df.mpg\n",
"\n",
"def show_plots(filenames):\n",
" for j in range(0,len(filenames),2):\n",
" if (len(filenames)-j)>1:\n",
" display(Markdown(f'![]({filenames[j]})![]({filenames[j+1]})'))\n",
" else:\n",
" display(Markdown(f'![]({filenames[j]})'))\n",
"\n",
"def make_plots(df, y):\n",
" filenames = []\n",
" \n",
" for col in df.columns:\n",
" filename = 'img/%s_joint.png' % col\n",
" filenames.append(filename)\n",
" if not exists(filename):\n",
" sns.jointplot(x=df[col],y=y,kind='reg',\n",
" joint_kws={'scatter_kws':dict(alpha=0.3)})\n",
" plt.suptitle(f'{col} vs mpg')\n",
" plt.subplots_adjust(top=.93)\n",
" plt.savefig(filename,facecolor='white',transparent=False)\n",
" plt.close()\n",
" \n",
" show_plots(filenames)"
]
},
{
"cell_type": "markdown",
"id": "7af7dcdd-9618-4e81-88c8-d2c2cde0fdc2",
"metadata": {},
"source": [
"So I'm only interested in a few things:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3e633f5f-8a7f-4776-a855-f22fcb87e88d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:50.952984Z",
"iopub.status.busy": "2022-07-21T20:29:50.952406Z",
"iopub.status.idle": "2022-07-21T20:29:50.967175Z",
"shell.execute_reply": "2022-07-21T20:29:50.966460Z",
"shell.execute_reply.started": "2022-07-21T20:29:50.952957Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/markdown": [
"![](img/cylinders_joint.png)![](img/displacement_joint.png)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"![](img/horsepower_joint.png)![](img/weight_joint.png)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"make_plots(df[['cylinders','displacement',\n",
" 'horsepower','weight',]],y)"
]
},
{
"cell_type": "markdown",
"id": "b0f65dd4-16b6-4222-8758-71e2ecac473e",
"metadata": {},
"source": [
"As the number of cylinders, displacement, horsepower, or weight increase, MPG goes down."
]
},
{
"cell_type": "markdown",
"id": "61b1b79e-46c2-4e7b-b565-84d1e2045777",
"metadata": {},
"source": [
"I want to know more:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7342da99-d04a-4f4f-ad3c-06840144ec48",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:50.969118Z",
"iopub.status.busy": "2022-07-21T20:29:50.968685Z",
"iopub.status.idle": "2022-07-21T20:29:50.977202Z",
"shell.execute_reply": "2022-07-21T20:29:50.976474Z",
"shell.execute_reply.started": "2022-07-21T20:29:50.969090Z"
},
"tags": []
},
"outputs": [],
"source": [
"new_features = pd.DataFrame()\n",
"new_features['efficiency'] = df.horsepower / df.displacement\n",
"new_features['load'] = df.displacement / df.weight\n",
"new_features['bore_size'] = df.displacement / df.cylinders\n",
"new_features['grunt'] = new_features.bore_size / new_features.efficiency"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "89cea145-4b6e-457b-9970-578144c1c364",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:50.979078Z",
"iopub.status.busy": "2022-07-21T20:29:50.978361Z",
"iopub.status.idle": "2022-07-21T20:29:50.984305Z",
"shell.execute_reply": "2022-07-21T20:29:50.983414Z",
"shell.execute_reply.started": "2022-07-21T20:29:50.979043Z"
},
"tags": []
},
"outputs": [],
"source": [
"merged = df.join(new_features)\n",
"del df"
]
},
{
"cell_type": "markdown",
"id": "0213061d-29c8-4f47-9128-705253bc6320",
"metadata": {},
"source": [
"Check Correlation"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7205bdab-a7df-41b4-9ec0-c1c9e2fe1c03",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:50.985966Z",
"iopub.status.busy": "2022-07-21T20:29:50.985567Z",
"iopub.status.idle": "2022-07-21T20:29:50.999141Z",
"shell.execute_reply": "2022-07-21T20:29:50.998300Z",
"shell.execute_reply.started": "2022-07-21T20:29:50.985938Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"weight -0.831745\n",
"displacement -0.804456\n",
"horsepower -0.777897\n",
"cylinders -0.776090\n",
"bore_size -0.773403\n",
"load -0.714996\n",
"grunt -0.712074\n",
"acceleration 0.420414\n",
"efficiency 0.509309\n",
"origin 0.563833\n",
"model_year 0.580091\n",
"mpg 1.000000\n",
"dtype: float64"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.corrwith(y).sort_values()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9fa0bf3e-d45b-4698-afac-e549db0de148",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.000637Z",
"iopub.status.busy": "2022-07-21T20:29:51.000343Z",
"iopub.status.idle": "2022-07-21T20:29:51.008598Z",
"shell.execute_reply": "2022-07-21T20:29:51.007461Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.000610Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/markdown": [
"![](img/efficiency_joint.png)![](img/load_joint.png)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"![](img/bore_size_joint.png)![](img/grunt_joint.png)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"make_plots(new_features,y)\n",
"del new_features"
]
},
{
"cell_type": "markdown",
"id": "5cbe16d7-24ef-4ceb-acd1-0dcecfdc96c2",
"metadata": {},
"source": [
"* HP per cubic inch is a measure of engine efficiency, as this increases so does MPG\n",
"* Load is a metric of how hard the engine has to work compared to its size. Engines that work hard use more fuel and a small engine working really hard can use more fuel than a big engine not doing much\n",
"* Bore_size is an attempt to describe cylinder bore diameter which gives insight on torque curve\n",
"* Grunt is an attempt to describe the power curve of an engine, or more specifically the presence/absence of low rpm torque output"
]
},
{
"cell_type": "markdown",
"id": "416a9d7e-e2ad-41f0-a674-d13c01f41896",
"metadata": {},
"source": [
"## A bit on engines:\n",
"\n",
"* A most basic description of an engine is that it's an air pump\n",
"* Horsepower = (Torque * RPM) / 5252\n",
"* Torque peak is where an engine is operating most efficiently as far as air flow, applied science in action. (Fluid dynamics, resonance)\n",
"* Operating above or below the torque peak reduces efficiency and efficiency == fuel economy\n",
"* Torque peaks normally occur below 5252rpm, and horsepower peaks above that, so long as the engine can actually rev that high. On a dyno sheet (measuring torque and horsepower vs rpm) you'll see the torque/horsepower lines cross at 5252rpm\n",
"* As an engine spins faster, the power output increases until combustion is so inefficient and it produces so little torque that spinning faster produces no more power, if it holds together that long\n",
"\n",
"Basically an engine that makes lots of power at high rpm but relatively little low end torque (mazda rotary), is going to have poor fuel economy because it spends most of its time outside of its efficiency range. In contrast, diesel engines typically turn lower rpms and create all kinds of torque down low. So not only do they start off making more torque but they are less likely to stray very far from torque peak. This is also why horsepower numbers on a diesel appear low, because they can't rev as high. There's more to it than this but this should be enough to provide context."
]
},
{
"cell_type": "markdown",
"id": "15d0d27b-5f92-4648-ad5c-35cc811430b3",
"metadata": {},
"source": [
"## Some stats"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "8710cba8-6b7e-4219-98b9-b7d5a1b4f4b9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.012153Z",
"iopub.status.busy": "2022-07-21T20:29:51.011763Z",
"iopub.status.idle": "2022-07-21T20:29:51.019164Z",
"shell.execute_reply": "2022-07-21T20:29:51.018305Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.012124Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Mean MPG: 23.51\n",
"Mean Weight: 2970.59\n",
"Mean Horsepower: 104.12\n",
"efficiency mean: 0.61\n",
"load mean: 0.06\n",
"bore_size mean: 33.36\n",
"grunt mean: 62.78\n"
]
}
],
"source": [
"print(f'''Mean MPG: {y.mean():.2f}\n",
"Mean Weight: {merged.weight.mean():.2f}\n",
"Mean Horsepower: {merged.horsepower.mean():.2f}''')\n",
"\n",
"for col in merged.columns[9:]:\n",
" print(f'{col} mean: {merged[col].mean():.2f}')"
]
},
{
"cell_type": "markdown",
"id": "d39b59e4-e596-4fc9-b886-1e6d314f597e",
"metadata": {},
"source": [
"### What's all that on the edges?"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "dbbfdab6-1cca-4329-a2ae-9258678ab0b1",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.020574Z",
"iopub.status.busy": "2022-07-21T20:29:51.020285Z",
"iopub.status.idle": "2022-07-21T20:29:51.043208Z",
"shell.execute_reply": "2022-07-21T20:29:51.042372Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.020547Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>19.0</td>\n",
" <td>3</td>\n",
" <td>70.0</td>\n",
" <td>97.0</td>\n",
" <td>2330.0</td>\n",
" <td>13.5</td>\n",
" <td>72</td>\n",
" <td>3</td>\n",
" <td>mazda rx2 coupe</td>\n",
" <td>1.385714</td>\n",
" <td>0.030043</td>\n",
" <td>23.333333</td>\n",
" <td>16.838488</td>\n",
" </tr>\n",
" <tr>\n",
" <th>111</th>\n",
" <td>18.0</td>\n",
" <td>3</td>\n",
" <td>70.0</td>\n",
" <td>90.0</td>\n",
" <td>2124.0</td>\n",
" <td>13.5</td>\n",
" <td>73</td>\n",
" <td>3</td>\n",
" <td>maxda rx3</td>\n",
" <td>1.285714</td>\n",
" <td>0.032957</td>\n",
" <td>23.333333</td>\n",
" <td>18.148148</td>\n",
" </tr>\n",
" <tr>\n",
" <th>243</th>\n",
" <td>21.5</td>\n",
" <td>3</td>\n",
" <td>80.0</td>\n",
" <td>110.0</td>\n",
" <td>2720.0</td>\n",
" <td>13.5</td>\n",
" <td>77</td>\n",
" <td>3</td>\n",
" <td>mazda rx-4</td>\n",
" <td>1.375000</td>\n",
" <td>0.029412</td>\n",
" <td>26.666667</td>\n",
" <td>19.393939</td>\n",
" </tr>\n",
" <tr>\n",
" <th>334</th>\n",
" <td>23.7</td>\n",
" <td>3</td>\n",
" <td>70.0</td>\n",
" <td>100.0</td>\n",
" <td>2420.0</td>\n",
" <td>12.5</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>mazda rx-7 gs</td>\n",
" <td>1.428571</td>\n",
" <td>0.028926</td>\n",
" <td>23.333333</td>\n",
" <td>16.333333</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"71 19.0 3 70.0 97.0 2330.0 13.5 \n",
"111 18.0 3 70.0 90.0 2124.0 13.5 \n",
"243 21.5 3 80.0 110.0 2720.0 13.5 \n",
"334 23.7 3 70.0 100.0 2420.0 12.5 \n",
"\n",
" model_year origin car_name efficiency load bore_size \\\n",
"71 72 3 mazda rx2 coupe 1.385714 0.030043 23.333333 \n",
"111 73 3 maxda rx3 1.285714 0.032957 23.333333 \n",
"243 77 3 mazda rx-4 1.375000 0.029412 26.666667 \n",
"334 80 3 mazda rx-7 gs 1.428571 0.028926 23.333333 \n",
"\n",
" grunt \n",
"71 16.838488 \n",
"111 18.148148 \n",
"243 19.393939 \n",
"334 16.333333 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged[merged.efficiency>1]"
]
},
{
"cell_type": "markdown",
"id": "d1f1bf61-6c9b-498e-a5de-6fbe6bb719d3",
"metadata": {},
"source": [
"These are the Mazda rotaries, otherwise known as [Wankel Engines](https://en.wikipedia.org/wiki/Wankel_engine)\n",
"\n",
"Efficient power for their size because they can rev to 7000rpm or so, and that's where they make peak power. Not good for fuel economy. Note the low gruntiness"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "20eaa490-f70b-408e-a9fa-c4ba05c8a1ac",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.044643Z",
"iopub.status.busy": "2022-07-21T20:29:51.044307Z",
"iopub.status.idle": "2022-07-21T20:29:51.062694Z",
"shell.execute_reply": "2022-07-21T20:29:51.061875Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.044616Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>274</th>\n",
" <td>20.3</td>\n",
" <td>5</td>\n",
" <td>131.0</td>\n",
" <td>103.0</td>\n",
" <td>2830.0</td>\n",
" <td>15.9</td>\n",
" <td>78</td>\n",
" <td>2</td>\n",
" <td>audi 5000</td>\n",
" <td>0.786260</td>\n",
" <td>0.046290</td>\n",
" <td>26.2</td>\n",
" <td>33.322330</td>\n",
" </tr>\n",
" <tr>\n",
" <th>297</th>\n",
" <td>25.4</td>\n",
" <td>5</td>\n",
" <td>183.0</td>\n",
" <td>77.0</td>\n",
" <td>3530.0</td>\n",
" <td>20.1</td>\n",
" <td>79</td>\n",
" <td>2</td>\n",
" <td>mercedes benz 300d</td>\n",
" <td>0.420765</td>\n",
" <td>0.051841</td>\n",
" <td>36.6</td>\n",
" <td>86.984416</td>\n",
" </tr>\n",
" <tr>\n",
" <th>327</th>\n",
" <td>36.4</td>\n",
" <td>5</td>\n",
" <td>121.0</td>\n",
" <td>67.0</td>\n",
" <td>2950.0</td>\n",
" <td>19.9</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>audi 5000s (diesel)</td>\n",
" <td>0.553719</td>\n",
" <td>0.041017</td>\n",
" <td>24.2</td>\n",
" <td>43.704478</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"274 20.3 5 131.0 103.0 2830.0 15.9 \n",
"297 25.4 5 183.0 77.0 3530.0 20.1 \n",
"327 36.4 5 121.0 67.0 2950.0 19.9 \n",
"\n",
" model_year origin car_name efficiency load bore_size \\\n",
"274 78 2 audi 5000 0.786260 0.046290 26.2 \n",
"297 79 2 mercedes benz 300d 0.420765 0.051841 36.6 \n",
"327 80 2 audi 5000s (diesel) 0.553719 0.041017 24.2 \n",
"\n",
" grunt \n",
"274 33.322330 \n",
"297 86.984416 \n",
"327 43.704478 "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged[merged.cylinders==5]"
]
},
{
"cell_type": "markdown",
"id": "33fb0fbd-595d-4129-bfe0-dd4077553f9a",
"metadata": {},
"source": [
"Look at the gruntiness and mpg of these diesels! For comparison the first Audi appears to be a gas engine. Consider the displacement and power. The one below as well"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0fb1ed64-bba6-463c-9a0f-84af360515b5",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.064733Z",
"iopub.status.busy": "2022-07-21T20:29:51.064060Z",
"iopub.status.idle": "2022-07-21T20:29:51.081301Z",
"shell.execute_reply": "2022-07-21T20:29:51.080572Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.064704Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>386</th>\n",
" <td>38.0</td>\n",
" <td>6</td>\n",
" <td>262.0</td>\n",
" <td>85.0</td>\n",
" <td>3015.0</td>\n",
" <td>17.0</td>\n",
" <td>82</td>\n",
" <td>1</td>\n",
" <td>oldsmobile cutlass ciera (diesel)</td>\n",
" <td>0.324427</td>\n",
" <td>0.086899</td>\n",
" <td>43.666667</td>\n",
" <td>134.596078</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"386 38.0 6 262.0 85.0 3015.0 17.0 \n",
"\n",
" model_year origin car_name efficiency \\\n",
"386 82 1 oldsmobile cutlass ciera (diesel) 0.324427 \n",
"\n",
" load bore_size grunt \n",
"386 0.086899 43.666667 134.596078 "
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.iloc[np.where((merged.mpg>35) & (merged.displacement > 250))]"
]
},
{
"cell_type": "markdown",
"id": "0456df70-dc3d-4879-95cb-26e268fea9aa",
"metadata": {},
"source": [
"This is an interesting engine. In fact, [these cars are rumored to be the reason why diesel cars are so unpopular in North America](https://www.autotrader.com/car-news/when-diesel-was-dreadful-oldsmobile-diesels-259997). [Here is a more technical write-up](https://www.dieselworldmag.com/diesel-engines/oldsmobile-350-v8)\n",
"\n",
"But that's a bit beside the point, the engines above and below for sake of conversation are basically the same, the V6 being the same as the V8 but with 2 less cylinders. So compare the stats between them as gas and diesel\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "c0c4f183-ef44-42ee-b64c-a75c63450d7b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.083196Z",
"iopub.status.busy": "2022-07-21T20:29:51.082422Z",
"iopub.status.idle": "2022-07-21T20:29:51.103099Z",
"shell.execute_reply": "2022-07-21T20:29:51.102309Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.083153Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>298</th>\n",
" <td>23.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>125.0</td>\n",
" <td>3900.0</td>\n",
" <td>17.4</td>\n",
" <td>79</td>\n",
" <td>1</td>\n",
" <td>cadillac eldorado</td>\n",
" <td>0.357143</td>\n",
" <td>0.089744</td>\n",
" <td>43.75</td>\n",
" <td>122.500000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>363</th>\n",
" <td>26.6</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>105.0</td>\n",
" <td>3725.0</td>\n",
" <td>19.0</td>\n",
" <td>81</td>\n",
" <td>1</td>\n",
" <td>oldsmobile cutlass ls</td>\n",
" <td>0.300000</td>\n",
" <td>0.093960</td>\n",
" <td>43.75</td>\n",
" <td>145.833333</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"298 23.0 8 350.0 125.0 3900.0 17.4 \n",
"363 26.6 8 350.0 105.0 3725.0 19.0 \n",
"\n",
" model_year origin car_name efficiency load \\\n",
"298 79 1 cadillac eldorado 0.357143 0.089744 \n",
"363 81 1 oldsmobile cutlass ls 0.300000 0.093960 \n",
"\n",
" bore_size grunt \n",
"298 43.75 122.500000 \n",
"363 43.75 145.833333 "
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.iloc[np.where((merged.mpg>20) & (merged.displacement > 340))]"
]
},
{
"cell_type": "markdown",
"id": "d8625227-6fca-4e92-ba0c-271bbea53c23",
"metadata": {},
"source": [
"Big lazy engines in big heavy cars don't have to have poor MPG!"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8f51f87e-fb76-4c8a-b4bc-05f147fc8efa",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.104577Z",
"iopub.status.busy": "2022-07-21T20:29:51.104277Z",
"iopub.status.idle": "2022-07-21T20:29:51.120670Z",
"shell.execute_reply": "2022-07-21T20:29:51.119898Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.104550Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>14.0</td>\n",
" <td>8</td>\n",
" <td>455.0</td>\n",
" <td>225.0</td>\n",
" <td>3086.0</td>\n",
" <td>10.0</td>\n",
" <td>70</td>\n",
" <td>1</td>\n",
" <td>buick estate wagon (sw)</td>\n",
" <td>0.494505</td>\n",
" <td>0.14744</td>\n",
" <td>56.875</td>\n",
" <td>115.013889</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"13 14.0 8 455.0 225.0 3086.0 10.0 \n",
"\n",
" model_year origin car_name efficiency load \\\n",
"13 70 1 buick estate wagon (sw) 0.494505 0.14744 \n",
"\n",
" bore_size grunt \n",
"13 56.875 115.013889 "
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged[merged.load>0.14]"
]
},
{
"cell_type": "markdown",
"id": "4415be3a-f8fb-47f1-b39d-2c60a3495a1d",
"metadata": {},
"source": [
"Big car, big engine, terrible MPG.. That weight is way off"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "7d556866-da6d-48dd-b37a-e59c3155085d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.122000Z",
"iopub.status.busy": "2022-07-21T20:29:51.121688Z",
"iopub.status.idle": "2022-07-21T20:29:51.127163Z",
"shell.execute_reply": "2022-07-21T20:29:51.126389Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.121973Z"
},
"tags": []
},
"outputs": [],
"source": [
"merged.at[13,'weight'] = 5000\n",
"merged['load'] = merged.displacement / merged.weight"
]
},
{
"cell_type": "markdown",
"id": "15d5a2c5-cb01-4a54-8ce4-375018ebc79a",
"metadata": {},
"source": [
"What vehicles have the lowest MPG?"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "1497a48c-42a3-447e-b1fb-e3a5b78902da",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.128643Z",
"iopub.status.busy": "2022-07-21T20:29:51.128285Z",
"iopub.status.idle": "2022-07-21T20:29:51.164545Z",
"shell.execute_reply": "2022-07-21T20:29:51.163776Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.128603Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>9.0</td>\n",
" <td>8</td>\n",
" <td>304.0</td>\n",
" <td>193.0</td>\n",
" <td>4732.0</td>\n",
" <td>18.5</td>\n",
" <td>70</td>\n",
" <td>1</td>\n",
" <td>hi 1200d</td>\n",
" <td>0.634868</td>\n",
" <td>0.064243</td>\n",
" <td>38.000</td>\n",
" <td>59.854922</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>10.0</td>\n",
" <td>8</td>\n",
" <td>307.0</td>\n",
" <td>200.0</td>\n",
" <td>4376.0</td>\n",
" <td>15.0</td>\n",
" <td>70</td>\n",
" <td>1</td>\n",
" <td>chevy c20</td>\n",
" <td>0.651466</td>\n",
" <td>0.070155</td>\n",
" <td>38.375</td>\n",
" <td>58.905625</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>10.0</td>\n",
" <td>8</td>\n",
" <td>360.0</td>\n",
" <td>215.0</td>\n",
" <td>4615.0</td>\n",
" <td>14.0</td>\n",
" <td>70</td>\n",
" <td>1</td>\n",
" <td>ford f250</td>\n",
" <td>0.597222</td>\n",
" <td>0.078007</td>\n",
" <td>45.000</td>\n",
" <td>75.348837</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>11.0</td>\n",
" <td>8</td>\n",
" <td>318.0</td>\n",
" <td>210.0</td>\n",
" <td>4382.0</td>\n",
" <td>13.5</td>\n",
" <td>70</td>\n",
" <td>1</td>\n",
" <td>dodge d200</td>\n",
" <td>0.660377</td>\n",
" <td>0.072570</td>\n",
" <td>39.750</td>\n",
" <td>60.192857</td>\n",
" </tr>\n",
" <tr>\n",
" <th>103</th>\n",
" <td>11.0</td>\n",
" <td>8</td>\n",
" <td>400.0</td>\n",
" <td>150.0</td>\n",
" <td>4997.0</td>\n",
" <td>14.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>chevrolet impala</td>\n",
" <td>0.375000</td>\n",
" <td>0.080048</td>\n",
" <td>50.000</td>\n",
" <td>133.333333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>67</th>\n",
" <td>11.0</td>\n",
" <td>8</td>\n",
" <td>429.0</td>\n",
" <td>208.0</td>\n",
" <td>4633.0</td>\n",
" <td>11.0</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>mercury marquis</td>\n",
" <td>0.484848</td>\n",
" <td>0.092597</td>\n",
" <td>53.625</td>\n",
" <td>110.601562</td>\n",
" </tr>\n",
" <tr>\n",
" <th>124</th>\n",
" <td>11.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>180.0</td>\n",
" <td>3664.0</td>\n",
" <td>11.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>oldsmobile omega</td>\n",
" <td>0.514286</td>\n",
" <td>0.095524</td>\n",
" <td>43.750</td>\n",
" <td>85.069444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>383.0</td>\n",
" <td>180.0</td>\n",
" <td>4955.0</td>\n",
" <td>11.5</td>\n",
" <td>71</td>\n",
" <td>1</td>\n",
" <td>dodge monaco (sw)</td>\n",
" <td>0.469974</td>\n",
" <td>0.077296</td>\n",
" <td>47.875</td>\n",
" <td>101.867361</td>\n",
" </tr>\n",
" <tr>\n",
" <th>95</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>455.0</td>\n",
" <td>225.0</td>\n",
" <td>4951.0</td>\n",
" <td>11.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>buick electra 225 custom</td>\n",
" <td>0.494505</td>\n",
" <td>0.091901</td>\n",
" <td>56.875</td>\n",
" <td>115.013889</td>\n",
" </tr>\n",
" <tr>\n",
" <th>90</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>429.0</td>\n",
" <td>198.0</td>\n",
" <td>4952.0</td>\n",
" <td>11.5</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>mercury marquis brougham</td>\n",
" <td>0.461538</td>\n",
" <td>0.086632</td>\n",
" <td>53.625</td>\n",
" <td>116.187500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>69</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>160.0</td>\n",
" <td>4456.0</td>\n",
" <td>13.5</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>oldsmobile delta 88 royale</td>\n",
" <td>0.457143</td>\n",
" <td>0.078546</td>\n",
" <td>43.750</td>\n",
" <td>95.703125</td>\n",
" </tr>\n",
" <tr>\n",
" <th>104</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>400.0</td>\n",
" <td>167.0</td>\n",
" <td>4906.0</td>\n",
" <td>12.5</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>ford country</td>\n",
" <td>0.417500</td>\n",
" <td>0.081533</td>\n",
" <td>50.000</td>\n",
" <td>119.760479</td>\n",
" </tr>\n",
" <tr>\n",
" <th>106</th>\n",
" <td>12.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>180.0</td>\n",
" <td>4499.0</td>\n",
" <td>12.5</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>oldsmobile vista cruiser</td>\n",
" <td>0.514286</td>\n",
" <td>0.077795</td>\n",
" <td>43.750</td>\n",
" <td>85.069444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>87</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>145.0</td>\n",
" <td>3988.0</td>\n",
" <td>13.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>chevrolet malibu</td>\n",
" <td>0.414286</td>\n",
" <td>0.087763</td>\n",
" <td>43.750</td>\n",
" <td>105.603448</td>\n",
" </tr>\n",
" <tr>\n",
" <th>73</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>307.0</td>\n",
" <td>130.0</td>\n",
" <td>4098.0</td>\n",
" <td>14.0</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>chevrolet chevelle concours (sw)</td>\n",
" <td>0.423453</td>\n",
" <td>0.074915</td>\n",
" <td>38.375</td>\n",
" <td>90.624038</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>302.0</td>\n",
" <td>140.0</td>\n",
" <td>4294.0</td>\n",
" <td>16.0</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>ford gran torino (sw)</td>\n",
" <td>0.463576</td>\n",
" <td>0.070331</td>\n",
" <td>37.750</td>\n",
" <td>81.432143</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>165.0</td>\n",
" <td>4274.0</td>\n",
" <td>12.0</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>chevrolet impala</td>\n",
" <td>0.471429</td>\n",
" <td>0.081891</td>\n",
" <td>43.750</td>\n",
" <td>92.803030</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>400.0</td>\n",
" <td>170.0</td>\n",
" <td>4746.0</td>\n",
" <td>12.0</td>\n",
" <td>71</td>\n",
" <td>1</td>\n",
" <td>ford country squire (sw)</td>\n",
" <td>0.425000</td>\n",
" <td>0.084282</td>\n",
" <td>50.000</td>\n",
" <td>117.647059</td>\n",
" </tr>\n",
" <tr>\n",
" <th>96</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>360.0</td>\n",
" <td>175.0</td>\n",
" <td>3821.0</td>\n",
" <td>11.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>amc ambassador brougham</td>\n",
" <td>0.486111</td>\n",
" <td>0.094216</td>\n",
" <td>45.000</td>\n",
" <td>92.571429</td>\n",
" </tr>\n",
" <tr>\n",
" <th>94</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>440.0</td>\n",
" <td>215.0</td>\n",
" <td>4735.0</td>\n",
" <td>11.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>chrysler new yorker brougham</td>\n",
" <td>0.488636</td>\n",
" <td>0.092925</td>\n",
" <td>55.000</td>\n",
" <td>112.558140</td>\n",
" </tr>\n",
" <tr>\n",
" <th>92</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>351.0</td>\n",
" <td>158.0</td>\n",
" <td>4363.0</td>\n",
" <td>13.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>ford ltd</td>\n",
" <td>0.450142</td>\n",
" <td>0.080449</td>\n",
" <td>43.875</td>\n",
" <td>97.469146</td>\n",
" </tr>\n",
" <tr>\n",
" <th>85</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>175.0</td>\n",
" <td>4100.0</td>\n",
" <td>13.0</td>\n",
" <td>73</td>\n",
" <td>1</td>\n",
" <td>buick century 350</td>\n",
" <td>0.500000</td>\n",
" <td>0.085366</td>\n",
" <td>43.750</td>\n",
" <td>87.500000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>137</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>350.0</td>\n",
" <td>150.0</td>\n",
" <td>4699.0</td>\n",
" <td>14.5</td>\n",
" <td>74</td>\n",
" <td>1</td>\n",
" <td>buick century luxus (sw)</td>\n",
" <td>0.428571</td>\n",
" <td>0.074484</td>\n",
" <td>43.750</td>\n",
" <td>102.083333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>400.0</td>\n",
" <td>175.0</td>\n",
" <td>5140.0</td>\n",
" <td>12.0</td>\n",
" <td>71</td>\n",
" <td>1</td>\n",
" <td>pontiac safari (sw)</td>\n",
" <td>0.437500</td>\n",
" <td>0.077821</td>\n",
" <td>50.000</td>\n",
" <td>114.285714</td>\n",
" </tr>\n",
" <tr>\n",
" <th>215</th>\n",
" <td>13.0</td>\n",
" <td>8</td>\n",
" <td>318.0</td>\n",
" <td>150.0</td>\n",
" <td>3755.0</td>\n",
" <td>14.0</td>\n",
" <td>76</td>\n",
" <td>1</td>\n",
" <td>dodge d100</td>\n",
" <td>0.471698</td>\n",
" <td>0.084687</td>\n",
" <td>39.750</td>\n",
" <td>84.270000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"28 9.0 8 304.0 193.0 4732.0 18.5 \n",
"26 10.0 8 307.0 200.0 4376.0 15.0 \n",
"25 10.0 8 360.0 215.0 4615.0 14.0 \n",
"27 11.0 8 318.0 210.0 4382.0 13.5 \n",
"103 11.0 8 400.0 150.0 4997.0 14.0 \n",
"67 11.0 8 429.0 208.0 4633.0 11.0 \n",
"124 11.0 8 350.0 180.0 3664.0 11.0 \n",
"42 12.0 8 383.0 180.0 4955.0 11.5 \n",
"95 12.0 8 455.0 225.0 4951.0 11.0 \n",
"90 12.0 8 429.0 198.0 4952.0 11.5 \n",
"69 12.0 8 350.0 160.0 4456.0 13.5 \n",
"104 12.0 8 400.0 167.0 4906.0 12.5 \n",
"106 12.0 8 350.0 180.0 4499.0 12.5 \n",
"87 13.0 8 350.0 145.0 3988.0 13.0 \n",
"73 13.0 8 307.0 130.0 4098.0 14.0 \n",
"74 13.0 8 302.0 140.0 4294.0 16.0 \n",
"62 13.0 8 350.0 165.0 4274.0 12.0 \n",
"43 13.0 8 400.0 170.0 4746.0 12.0 \n",
"96 13.0 8 360.0 175.0 3821.0 11.0 \n",
"94 13.0 8 440.0 215.0 4735.0 11.0 \n",
"92 13.0 8 351.0 158.0 4363.0 13.0 \n",
"85 13.0 8 350.0 175.0 4100.0 13.0 \n",
"137 13.0 8 350.0 150.0 4699.0 14.5 \n",
"44 13.0 8 400.0 175.0 5140.0 12.0 \n",
"215 13.0 8 318.0 150.0 3755.0 14.0 \n",
"\n",
" model_year origin car_name efficiency \\\n",
"28 70 1 hi 1200d 0.634868 \n",
"26 70 1 chevy c20 0.651466 \n",
"25 70 1 ford f250 0.597222 \n",
"27 70 1 dodge d200 0.660377 \n",
"103 73 1 chevrolet impala 0.375000 \n",
"67 72 1 mercury marquis 0.484848 \n",
"124 73 1 oldsmobile omega 0.514286 \n",
"42 71 1 dodge monaco (sw) 0.469974 \n",
"95 73 1 buick electra 225 custom 0.494505 \n",
"90 73 1 mercury marquis brougham 0.461538 \n",
"69 72 1 oldsmobile delta 88 royale 0.457143 \n",
"104 73 1 ford country 0.417500 \n",
"106 73 1 oldsmobile vista cruiser 0.514286 \n",
"87 73 1 chevrolet malibu 0.414286 \n",
"73 72 1 chevrolet chevelle concours (sw) 0.423453 \n",
"74 72 1 ford gran torino (sw) 0.463576 \n",
"62 72 1 chevrolet impala 0.471429 \n",
"43 71 1 ford country squire (sw) 0.425000 \n",
"96 73 1 amc ambassador brougham 0.486111 \n",
"94 73 1 chrysler new yorker brougham 0.488636 \n",
"92 73 1 ford ltd 0.450142 \n",
"85 73 1 buick century 350 0.500000 \n",
"137 74 1 buick century luxus (sw) 0.428571 \n",
"44 71 1 pontiac safari (sw) 0.437500 \n",
"215 76 1 dodge d100 0.471698 \n",
"\n",
" load bore_size grunt \n",
"28 0.064243 38.000 59.854922 \n",
"26 0.070155 38.375 58.905625 \n",
"25 0.078007 45.000 75.348837 \n",
"27 0.072570 39.750 60.192857 \n",
"103 0.080048 50.000 133.333333 \n",
"67 0.092597 53.625 110.601562 \n",
"124 0.095524 43.750 85.069444 \n",
"42 0.077296 47.875 101.867361 \n",
"95 0.091901 56.875 115.013889 \n",
"90 0.086632 53.625 116.187500 \n",
"69 0.078546 43.750 95.703125 \n",
"104 0.081533 50.000 119.760479 \n",
"106 0.077795 43.750 85.069444 \n",
"87 0.087763 43.750 105.603448 \n",
"73 0.074915 38.375 90.624038 \n",
"74 0.070331 37.750 81.432143 \n",
"62 0.081891 43.750 92.803030 \n",
"43 0.084282 50.000 117.647059 \n",
"96 0.094216 45.000 92.571429 \n",
"94 0.092925 55.000 112.558140 \n",
"92 0.080449 43.875 97.469146 \n",
"85 0.085366 43.750 87.500000 \n",
"137 0.074484 43.750 102.083333 \n",
"44 0.077821 50.000 114.285714 \n",
"215 0.084687 39.750 84.270000 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.sort_values('mpg').head(25)"
]
},
{
"cell_type": "markdown",
"id": "146d6761-455a-407f-b627-24c13586a88f",
"metadata": {},
"source": [
"What vehicles have the Highest MPG?"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "38935e91-3877-47a3-96d6-cd54e2704bdb",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.166013Z",
"iopub.status.busy": "2022-07-21T20:29:51.165720Z",
"iopub.status.idle": "2022-07-21T20:29:51.199742Z",
"shell.execute_reply": "2022-07-21T20:29:51.199027Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.165986Z"
},
"tags": []
},
"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>mpg</th>\n",
" <th>cylinders</th>\n",
" <th>displacement</th>\n",
" <th>horsepower</th>\n",
" <th>weight</th>\n",
" <th>acceleration</th>\n",
" <th>model_year</th>\n",
" <th>origin</th>\n",
" <th>car_name</th>\n",
" <th>efficiency</th>\n",
" <th>load</th>\n",
" <th>bore_size</th>\n",
" <th>grunt</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>322</th>\n",
" <td>46.6</td>\n",
" <td>4</td>\n",
" <td>86.0</td>\n",
" <td>65.0</td>\n",
" <td>2110.0</td>\n",
" <td>17.9</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>mazda glc</td>\n",
" <td>0.755814</td>\n",
" <td>0.040758</td>\n",
" <td>21.500000</td>\n",
" <td>28.446154</td>\n",
" </tr>\n",
" <tr>\n",
" <th>329</th>\n",
" <td>44.6</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>67.0</td>\n",
" <td>1850.0</td>\n",
" <td>13.8</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>honda civic 1500 gl</td>\n",
" <td>0.736264</td>\n",
" <td>0.049189</td>\n",
" <td>22.750000</td>\n",
" <td>30.899254</td>\n",
" </tr>\n",
" <tr>\n",
" <th>325</th>\n",
" <td>44.3</td>\n",
" <td>4</td>\n",
" <td>90.0</td>\n",
" <td>48.0</td>\n",
" <td>2085.0</td>\n",
" <td>21.7</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>vw rabbit c (diesel)</td>\n",
" <td>0.533333</td>\n",
" <td>0.043165</td>\n",
" <td>22.500000</td>\n",
" <td>42.187500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>393</th>\n",
" <td>44.0</td>\n",
" <td>4</td>\n",
" <td>97.0</td>\n",
" <td>52.0</td>\n",
" <td>2130.0</td>\n",
" <td>24.6</td>\n",
" <td>82</td>\n",
" <td>2</td>\n",
" <td>vw pickup</td>\n",
" <td>0.536082</td>\n",
" <td>0.045540</td>\n",
" <td>24.250000</td>\n",
" <td>45.235577</td>\n",
" </tr>\n",
" <tr>\n",
" <th>326</th>\n",
" <td>43.4</td>\n",
" <td>4</td>\n",
" <td>90.0</td>\n",
" <td>48.0</td>\n",
" <td>2335.0</td>\n",
" <td>23.7</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>vw dasher (diesel)</td>\n",
" <td>0.533333</td>\n",
" <td>0.038544</td>\n",
" <td>22.500000</td>\n",
" <td>42.187500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>244</th>\n",
" <td>43.1</td>\n",
" <td>4</td>\n",
" <td>90.0</td>\n",
" <td>48.0</td>\n",
" <td>1985.0</td>\n",
" <td>21.5</td>\n",
" <td>78</td>\n",
" <td>2</td>\n",
" <td>volkswagen rabbit custom diesel</td>\n",
" <td>0.533333</td>\n",
" <td>0.045340</td>\n",
" <td>22.500000</td>\n",
" <td>42.187500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>309</th>\n",
" <td>41.5</td>\n",
" <td>4</td>\n",
" <td>98.0</td>\n",
" <td>76.0</td>\n",
" <td>2144.0</td>\n",
" <td>14.7</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>vw rabbit</td>\n",
" <td>0.775510</td>\n",
" <td>0.045709</td>\n",
" <td>24.500000</td>\n",
" <td>31.592105</td>\n",
" </tr>\n",
" <tr>\n",
" <th>330</th>\n",
" <td>40.9</td>\n",
" <td>4</td>\n",
" <td>85.0</td>\n",
" <td>53.5</td>\n",
" <td>1835.0</td>\n",
" <td>17.3</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>renault lecar deluxe</td>\n",
" <td>0.629412</td>\n",
" <td>0.046322</td>\n",
" <td>21.250000</td>\n",
" <td>33.761682</td>\n",
" </tr>\n",
" <tr>\n",
" <th>324</th>\n",
" <td>40.8</td>\n",
" <td>4</td>\n",
" <td>85.0</td>\n",
" <td>65.0</td>\n",
" <td>2110.0</td>\n",
" <td>19.2</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>datsun 210</td>\n",
" <td>0.764706</td>\n",
" <td>0.040284</td>\n",
" <td>21.250000</td>\n",
" <td>27.788462</td>\n",
" </tr>\n",
" <tr>\n",
" <th>247</th>\n",
" <td>39.4</td>\n",
" <td>4</td>\n",
" <td>85.0</td>\n",
" <td>70.0</td>\n",
" <td>2070.0</td>\n",
" <td>18.6</td>\n",
" <td>78</td>\n",
" <td>3</td>\n",
" <td>datsun b210 gx</td>\n",
" <td>0.823529</td>\n",
" <td>0.041063</td>\n",
" <td>21.250000</td>\n",
" <td>25.803571</td>\n",
" </tr>\n",
" <tr>\n",
" <th>342</th>\n",
" <td>39.1</td>\n",
" <td>4</td>\n",
" <td>79.0</td>\n",
" <td>58.0</td>\n",
" <td>1755.0</td>\n",
" <td>16.9</td>\n",
" <td>81</td>\n",
" <td>3</td>\n",
" <td>toyota starlet</td>\n",
" <td>0.734177</td>\n",
" <td>0.045014</td>\n",
" <td>19.750000</td>\n",
" <td>26.900862</td>\n",
" </tr>\n",
" <tr>\n",
" <th>343</th>\n",
" <td>39.0</td>\n",
" <td>4</td>\n",
" <td>86.0</td>\n",
" <td>64.0</td>\n",
" <td>1875.0</td>\n",
" <td>16.4</td>\n",
" <td>81</td>\n",
" <td>1</td>\n",
" <td>plymouth champ</td>\n",
" <td>0.744186</td>\n",
" <td>0.045867</td>\n",
" <td>21.500000</td>\n",
" <td>28.890625</td>\n",
" </tr>\n",
" <tr>\n",
" <th>310</th>\n",
" <td>38.1</td>\n",
" <td>4</td>\n",
" <td>89.0</td>\n",
" <td>60.0</td>\n",
" <td>1968.0</td>\n",
" <td>18.8</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>toyota corolla tercel</td>\n",
" <td>0.674157</td>\n",
" <td>0.045224</td>\n",
" <td>22.250000</td>\n",
" <td>33.004167</td>\n",
" </tr>\n",
" <tr>\n",
" <th>384</th>\n",
" <td>38.0</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>67.0</td>\n",
" <td>1995.0</td>\n",
" <td>16.2</td>\n",
" <td>82</td>\n",
" <td>3</td>\n",
" <td>datsun 310 gx</td>\n",
" <td>0.736264</td>\n",
" <td>0.045614</td>\n",
" <td>22.750000</td>\n",
" <td>30.899254</td>\n",
" </tr>\n",
" <tr>\n",
" <th>382</th>\n",
" <td>38.0</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>67.0</td>\n",
" <td>1965.0</td>\n",
" <td>15.0</td>\n",
" <td>82</td>\n",
" <td>3</td>\n",
" <td>honda civic</td>\n",
" <td>0.736264</td>\n",
" <td>0.046310</td>\n",
" <td>22.750000</td>\n",
" <td>30.899254</td>\n",
" </tr>\n",
" <tr>\n",
" <th>386</th>\n",
" <td>38.0</td>\n",
" <td>6</td>\n",
" <td>262.0</td>\n",
" <td>85.0</td>\n",
" <td>3015.0</td>\n",
" <td>17.0</td>\n",
" <td>82</td>\n",
" <td>1</td>\n",
" <td>oldsmobile cutlass ciera (diesel)</td>\n",
" <td>0.324427</td>\n",
" <td>0.086899</td>\n",
" <td>43.666667</td>\n",
" <td>134.596078</td>\n",
" </tr>\n",
" <tr>\n",
" <th>377</th>\n",
" <td>38.0</td>\n",
" <td>4</td>\n",
" <td>105.0</td>\n",
" <td>63.0</td>\n",
" <td>2125.0</td>\n",
" <td>14.7</td>\n",
" <td>82</td>\n",
" <td>1</td>\n",
" <td>plymouth horizon miser</td>\n",
" <td>0.600000</td>\n",
" <td>0.049412</td>\n",
" <td>26.250000</td>\n",
" <td>43.750000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>347</th>\n",
" <td>37.7</td>\n",
" <td>4</td>\n",
" <td>89.0</td>\n",
" <td>62.0</td>\n",
" <td>2050.0</td>\n",
" <td>17.3</td>\n",
" <td>81</td>\n",
" <td>3</td>\n",
" <td>toyota tercel</td>\n",
" <td>0.696629</td>\n",
" <td>0.043415</td>\n",
" <td>22.250000</td>\n",
" <td>31.939516</td>\n",
" </tr>\n",
" <tr>\n",
" <th>304</th>\n",
" <td>37.3</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>69.0</td>\n",
" <td>2130.0</td>\n",
" <td>14.7</td>\n",
" <td>79</td>\n",
" <td>2</td>\n",
" <td>fiat strada custom</td>\n",
" <td>0.758242</td>\n",
" <td>0.042723</td>\n",
" <td>22.750000</td>\n",
" <td>30.003623</td>\n",
" </tr>\n",
" <tr>\n",
" <th>312</th>\n",
" <td>37.2</td>\n",
" <td>4</td>\n",
" <td>86.0</td>\n",
" <td>65.0</td>\n",
" <td>2019.0</td>\n",
" <td>16.4</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>datsun 310</td>\n",
" <td>0.755814</td>\n",
" <td>0.042595</td>\n",
" <td>21.500000</td>\n",
" <td>28.446154</td>\n",
" </tr>\n",
" <tr>\n",
" <th>375</th>\n",
" <td>37.0</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>68.0</td>\n",
" <td>2025.0</td>\n",
" <td>18.2</td>\n",
" <td>82</td>\n",
" <td>3</td>\n",
" <td>mazda glc custom l</td>\n",
" <td>0.747253</td>\n",
" <td>0.044938</td>\n",
" <td>22.750000</td>\n",
" <td>30.444853</td>\n",
" </tr>\n",
" <tr>\n",
" <th>346</th>\n",
" <td>37.0</td>\n",
" <td>4</td>\n",
" <td>85.0</td>\n",
" <td>65.0</td>\n",
" <td>1975.0</td>\n",
" <td>19.4</td>\n",
" <td>81</td>\n",
" <td>3</td>\n",
" <td>datsun 210 mpg</td>\n",
" <td>0.764706</td>\n",
" <td>0.043038</td>\n",
" <td>21.250000</td>\n",
" <td>27.788462</td>\n",
" </tr>\n",
" <tr>\n",
" <th>320</th>\n",
" <td>37.0</td>\n",
" <td>4</td>\n",
" <td>119.0</td>\n",
" <td>92.0</td>\n",
" <td>2434.0</td>\n",
" <td>15.0</td>\n",
" <td>80</td>\n",
" <td>3</td>\n",
" <td>datsun 510 hatchback</td>\n",
" <td>0.773109</td>\n",
" <td>0.048891</td>\n",
" <td>29.750000</td>\n",
" <td>38.480978</td>\n",
" </tr>\n",
" <tr>\n",
" <th>327</th>\n",
" <td>36.4</td>\n",
" <td>5</td>\n",
" <td>121.0</td>\n",
" <td>67.0</td>\n",
" <td>2950.0</td>\n",
" <td>19.9</td>\n",
" <td>80</td>\n",
" <td>2</td>\n",
" <td>audi 5000s (diesel)</td>\n",
" <td>0.553719</td>\n",
" <td>0.041017</td>\n",
" <td>24.200000</td>\n",
" <td>43.704478</td>\n",
" </tr>\n",
" <tr>\n",
" <th>248</th>\n",
" <td>36.1</td>\n",
" <td>4</td>\n",
" <td>91.0</td>\n",
" <td>60.0</td>\n",
" <td>1800.0</td>\n",
" <td>16.4</td>\n",
" <td>78</td>\n",
" <td>3</td>\n",
" <td>honda civic cvcc</td>\n",
" <td>0.659341</td>\n",
" <td>0.050556</td>\n",
" <td>22.750000</td>\n",
" <td>34.504167</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mpg cylinders displacement horsepower weight acceleration \\\n",
"322 46.6 4 86.0 65.0 2110.0 17.9 \n",
"329 44.6 4 91.0 67.0 1850.0 13.8 \n",
"325 44.3 4 90.0 48.0 2085.0 21.7 \n",
"393 44.0 4 97.0 52.0 2130.0 24.6 \n",
"326 43.4 4 90.0 48.0 2335.0 23.7 \n",
"244 43.1 4 90.0 48.0 1985.0 21.5 \n",
"309 41.5 4 98.0 76.0 2144.0 14.7 \n",
"330 40.9 4 85.0 53.5 1835.0 17.3 \n",
"324 40.8 4 85.0 65.0 2110.0 19.2 \n",
"247 39.4 4 85.0 70.0 2070.0 18.6 \n",
"342 39.1 4 79.0 58.0 1755.0 16.9 \n",
"343 39.0 4 86.0 64.0 1875.0 16.4 \n",
"310 38.1 4 89.0 60.0 1968.0 18.8 \n",
"384 38.0 4 91.0 67.0 1995.0 16.2 \n",
"382 38.0 4 91.0 67.0 1965.0 15.0 \n",
"386 38.0 6 262.0 85.0 3015.0 17.0 \n",
"377 38.0 4 105.0 63.0 2125.0 14.7 \n",
"347 37.7 4 89.0 62.0 2050.0 17.3 \n",
"304 37.3 4 91.0 69.0 2130.0 14.7 \n",
"312 37.2 4 86.0 65.0 2019.0 16.4 \n",
"375 37.0 4 91.0 68.0 2025.0 18.2 \n",
"346 37.0 4 85.0 65.0 1975.0 19.4 \n",
"320 37.0 4 119.0 92.0 2434.0 15.0 \n",
"327 36.4 5 121.0 67.0 2950.0 19.9 \n",
"248 36.1 4 91.0 60.0 1800.0 16.4 \n",
"\n",
" model_year origin car_name efficiency \\\n",
"322 80 3 mazda glc 0.755814 \n",
"329 80 3 honda civic 1500 gl 0.736264 \n",
"325 80 2 vw rabbit c (diesel) 0.533333 \n",
"393 82 2 vw pickup 0.536082 \n",
"326 80 2 vw dasher (diesel) 0.533333 \n",
"244 78 2 volkswagen rabbit custom diesel 0.533333 \n",
"309 80 2 vw rabbit 0.775510 \n",
"330 80 2 renault lecar deluxe 0.629412 \n",
"324 80 3 datsun 210 0.764706 \n",
"247 78 3 datsun b210 gx 0.823529 \n",
"342 81 3 toyota starlet 0.734177 \n",
"343 81 1 plymouth champ 0.744186 \n",
"310 80 3 toyota corolla tercel 0.674157 \n",
"384 82 3 datsun 310 gx 0.736264 \n",
"382 82 3 honda civic 0.736264 \n",
"386 82 1 oldsmobile cutlass ciera (diesel) 0.324427 \n",
"377 82 1 plymouth horizon miser 0.600000 \n",
"347 81 3 toyota tercel 0.696629 \n",
"304 79 2 fiat strada custom 0.758242 \n",
"312 80 3 datsun 310 0.755814 \n",
"375 82 3 mazda glc custom l 0.747253 \n",
"346 81 3 datsun 210 mpg 0.764706 \n",
"320 80 3 datsun 510 hatchback 0.773109 \n",
"327 80 2 audi 5000s (diesel) 0.553719 \n",
"248 78 3 honda civic cvcc 0.659341 \n",
"\n",
" load bore_size grunt \n",
"322 0.040758 21.500000 28.446154 \n",
"329 0.049189 22.750000 30.899254 \n",
"325 0.043165 22.500000 42.187500 \n",
"393 0.045540 24.250000 45.235577 \n",
"326 0.038544 22.500000 42.187500 \n",
"244 0.045340 22.500000 42.187500 \n",
"309 0.045709 24.500000 31.592105 \n",
"330 0.046322 21.250000 33.761682 \n",
"324 0.040284 21.250000 27.788462 \n",
"247 0.041063 21.250000 25.803571 \n",
"342 0.045014 19.750000 26.900862 \n",
"343 0.045867 21.500000 28.890625 \n",
"310 0.045224 22.250000 33.004167 \n",
"384 0.045614 22.750000 30.899254 \n",
"382 0.046310 22.750000 30.899254 \n",
"386 0.086899 43.666667 134.596078 \n",
"377 0.049412 26.250000 43.750000 \n",
"347 0.043415 22.250000 31.939516 \n",
"304 0.042723 22.750000 30.003623 \n",
"312 0.042595 21.500000 28.446154 \n",
"375 0.044938 22.750000 30.444853 \n",
"346 0.043038 21.250000 27.788462 \n",
"320 0.048891 29.750000 38.480978 \n",
"327 0.041017 24.200000 43.704478 \n",
"248 0.050556 22.750000 34.504167 "
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.sort_values('mpg',ascending=False).head(25)"
]
},
{
"cell_type": "markdown",
"id": "27e89d6b-7603-403c-8235-e9bad49040b3",
"metadata": {},
"source": [
"Pick a few to toss into the model and get some numbers out"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "52d0ffbf-55aa-49b9-b99f-8160bf09cc79",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.201570Z",
"iopub.status.busy": "2022-07-21T20:29:51.200911Z",
"iopub.status.idle": "2022-07-21T20:29:51.207432Z",
"shell.execute_reply": "2022-07-21T20:29:51.206526Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.201525Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['mpg', 'cylinders', 'displacement', 'horsepower', 'weight',\n",
" 'acceleration', 'model_year', 'origin', 'car_name', 'efficiency',\n",
" 'load', 'bore_size', 'grunt'],\n",
" dtype='object')"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged.columns"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "6a4a9e48-57a1-48b6-b289-58bc43584112",
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-21T20:29:51.209219Z",
"iopub.status.busy": "2022-07-21T20:29:51.208620Z",
"iopub.status.idle": "2022-07-21T20:29:51.220516Z",
"shell.execute_reply": "2022-07-21T20:29:51.219766Z",
"shell.execute_reply.started": "2022-07-21T20:29:51.209190Z"
},
"tags": []
},
"outputs": [],
"source": [
"X = merged[[\\\n",
" 'horsepower', # overall power\n",
" 'bore_size', # \"torque curve\"\n",
" 'grunt',\n",
" 'load', # load\n",
" ]]\n",
"\n",
"X.to_csv('data/X.csv',index=False)\n",
"y.to_csv('data/y.csv',index=False)"
]
},
{
"cell_type": "markdown",
"id": "4802d1fd-079c-4053-88f2-b5dca7cf8dae",
"metadata": {},
"source": [
"[Modeling](model.ipynb)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}