Last active
June 9, 2020 03:04
-
-
Save ankitmishra88/4e55503578aa8f4e001367c236749269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# import pandas as pd" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Series Object: One dimensional labelled array\n", | |
"contains data of similar or mixed type" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"C:\\Users\\4WallSpace\\Anaconda\\lib\\site-packages\\pandas\\__init__.py\n" | |
] | |
} | |
], | |
"source": [ | |
"import pandas as pd\n", | |
"print(pd.__file__)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0 1\n", | |
"1 2\n", | |
"2 3\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pd.Series([1,2,3])" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# creating Series Object" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0 1\n", | |
"1 2\n", | |
"2 3\n", | |
"dtype: int64\n" | |
] | |
} | |
], | |
"source": [ | |
"srs=pd.Series([1,2,3])\n", | |
"print(srs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0 [1, 2, 3]\n", | |
"1 [4, 5, 6]\n", | |
"2 [6, 7, 8]\n", | |
"dtype: object" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"srs=pd.Series([[1,2,3],[4,5,6],[6,7,8]])\n", | |
"srs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Type Of Series" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"<class 'pandas.core.series.Series'>\n" | |
] | |
} | |
], | |
"source": [ | |
"print(type(srs))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Change Index of Series" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 27, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"a 1\n", | |
"b 2\n", | |
"c 3\n", | |
"d 4\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 27, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"data=[1,2,3,4]\n", | |
"srs=pd.Series([1,2,3,4],index=['a','b','c','d'])\n", | |
"srs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 28, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"a 1\n", | |
"b 2\n", | |
"c 3\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 28, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"srs=pd.Series([1,2,3],['a','b','c'])\n", | |
"srs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 29, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Accessing Series element" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 31, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"1\n" | |
] | |
} | |
], | |
"source": [ | |
"print(srs['a'])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 32, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"a 1\n", | |
"b 2\n", | |
"c 3\n", | |
"dtype: int64\n" | |
] | |
} | |
], | |
"source": [ | |
"print(srs['a':'c']) #Not Excludes righthand index" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"a 1\n", | |
"b 2\n", | |
"dtype: int64\n" | |
] | |
} | |
], | |
"source": [ | |
"print(srs[:-1]) #Negative indexing still works after changing" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"1\n", | |
"a 1\n", | |
"b 2\n", | |
"c 3\n", | |
"dtype: int64\n", | |
"a 1\n", | |
"b 2\n", | |
"dtype: int64\n" | |
] | |
} | |
], | |
"source": [ | |
"print(srs[0])#Elements of series still can be accessed by index value\n", | |
"print(srs[0:]) \n", | |
"print(srs[0:2])# While indexing still excludes right hand index" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#Array,Dictionary and scalar all three can be changed to series" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 47, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"name Ankit\n", | |
"Age 20\n", | |
"dtype: object\n", | |
"0 20\n", | |
"1 30\n", | |
"2 40\n", | |
"dtype: int32\n", | |
"0 1\n", | |
"1 2\n", | |
"2 3\n", | |
"dtype: int64\n", | |
"0 [1, 2, 3]\n", | |
"1 [4, 5, 6, 7]\n", | |
"dtype: object\n" | |
] | |
} | |
], | |
"source": [ | |
"import numpy as np\n", | |
"dict={'name':\"Ankit\",'Age':20}\n", | |
"srs=pd.Series(dict)\n", | |
"print(srs)\n", | |
"arr=np.array([20,30,40])\n", | |
"srs=pd.Series(arr)\n", | |
"print(srs)\n", | |
"srs=pd.Series([1,2,3])\n", | |
"print(srs)\n", | |
"srs=pd.Series([[1,2,3],[4,5,6,7]])\n", | |
"print(srs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# DataFrame\n", | |
"#Two dimensional labelled Data(row labelling,column labelling)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 51, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
" 0 1 2 3 4\n", | |
"0 1 2 3 4 NaN\n", | |
"1 1 2 3 4 5.0\n" | |
] | |
} | |
], | |
"source": [ | |
"data=[[1,2,3,4],[1,2,3,4,5]]\n", | |
"df=pd.DataFrame(data)\n", | |
"print(df)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 52, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#Example Using Dictionary" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 54, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
" a b\n", | |
"0 1 4\n", | |
"1 2 5\n", | |
"2 3 7\n", | |
"3 4 9\n", | |
"4 5 11\n" | |
] | |
} | |
], | |
"source": [ | |
"data={'a':[1,2,3,4,5],'b':[4,5,7,9,11]}\n", | |
"dF=pd.DataFrame(data)\n", | |
"print(dF)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 55, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#data in column should be same here otherwise it will show error" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 58, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "ValueError", | |
"evalue": "arrays must all be same length", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", | |
"\u001b[1;32m<ipython-input-58-1faf53533173>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m{\u001b[0m\u001b[1;34m'a'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'b'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mdF\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdF\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m 409\u001b[0m )\n\u001b[0;32m 410\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 411\u001b[1;33m \u001b[0mmgr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minit_dict\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 412\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mma\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mMaskedArray\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 413\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mma\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmrecords\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mmrecords\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36minit_dict\u001b[1;34m(data, index, columns, dtype)\u001b[0m\n\u001b[0;32m 255\u001b[0m \u001b[0marr\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mis_datetime64tz_dtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marr\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32melse\u001b[0m \u001b[0marr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0marr\u001b[0m \u001b[1;32min\u001b[0m \u001b[0marrays\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 256\u001b[0m ]\n\u001b[1;32m--> 257\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0marrays_to_mgr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marrays\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata_names\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 258\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 259\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36marrays_to_mgr\u001b[1;34m(arrays, arr_names, index, columns, dtype)\u001b[0m\n\u001b[0;32m 75\u001b[0m \u001b[1;31m# figure out the index, if necessary\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 76\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 77\u001b[1;33m \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextract_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marrays\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 78\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 79\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mensure_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindex\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36mextract_index\u001b[1;34m(data)\u001b[0m\n\u001b[0;32m 366\u001b[0m \u001b[0mlengths\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mraw_lengths\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 367\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlengths\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 368\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"arrays must all be same length\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 369\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 370\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mhave_dicts\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;31mValueError\u001b[0m: arrays must all be same length" | |
] | |
} | |
], | |
"source": [ | |
"data={'a':[1,2,3,4],'b':[3,4,3]}\n", | |
"dF=pd.DataFrame(data)\n", | |
"print(dF)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 59, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#Creating a DataFrame from Series Object" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 63, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"a 1\n", | |
"b 3\n", | |
"c 4\n", | |
"dtype: int64\n", | |
" 0\n", | |
"a 1\n", | |
"b 3\n", | |
"c 4\n" | |
] | |
} | |
], | |
"source": [ | |
"srs=pd.Series([1,3,4],index=['a','b','c'])\n", | |
"print(srs)\n", | |
"df=pd.DataFrame(srs)\n", | |
"print(df)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 64, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#creating a DataFrame from a numpy ndarray" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 33, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"[[1 2 3 4]\n", | |
" [3 4 5 5]]\n", | |
" 0 1 2 3\n", | |
"0 1 2 3 4\n", | |
"1 3 4 5 5\n" | |
] | |
} | |
], | |
"source": [ | |
"nd=np.array([[1,2,3,4],[3,4,5,5]])\n", | |
"print(nd)\n", | |
"df=pd.DataFrame(nd)\n", | |
"print(df)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 83, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
" a b\n", | |
"0 1 2\n", | |
"1 3 4\n" | |
] | |
} | |
], | |
"source": [ | |
"df=pd.DataFrame({'a':nd[:,0],'b':nd[:,1]})\n", | |
"print(df)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Merge, Join,Concatenate" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### DataFrame For Pandas Merge\n", | |
"1.Left Merge Left Join 2.Right Merge Right Join \n", | |
"3.Inner Merge Inner Join 4.Outer Merge Outer Join" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"C:\\Users\\Ankit\\Anaconda\\lib\\site-packages\\ipykernel_launcher.py:4: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\n", | |
"of pandas will change to not sort by default.\n", | |
"\n", | |
"To accept the future behavior, pass 'sort=False'.\n", | |
"\n", | |
"To retain the current behavior and silence the warning, pass 'sort=True'.\n", | |
"\n", | |
" after removing the cwd from sys.path.\n" | |
] | |
}, | |
{ | |
"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>Age</th>\n", | |
" <th>Name</th>\n", | |
" <th>cricket</th>\n", | |
" <th>study</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>18</td>\n", | |
" <td>Ankit</td>\n", | |
" <td>NaN</td>\n", | |
" <td>top</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>19</td>\n", | |
" <td>Ayush</td>\n", | |
" <td>100.0</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Age Name cricket study\n", | |
"0 18 Ankit NaN top\n", | |
"0 19 Ayush 100.0 NaN" | |
] | |
}, | |
"execution_count": 34, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Concatenate\n", | |
"df1=pd.DataFrame({\"Name\":[\"Ankit\"],\"Age\":[18],\"study\":[\"top\"]})\n", | |
"df2=pd.DataFrame({\"Name\":[\"Ayush\"],\"Age\":[19],\"cricket\":[100]})\n", | |
"pd.concat([df1,df2])\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 90, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#concat is a kind of Outer Join by default" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 93, | |
"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>Name</th>\n", | |
" <th>Age</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Ankit</td>\n", | |
" <td>18</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Ayush</td>\n", | |
" <td>19</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name Age\n", | |
"0 Ankit 18\n", | |
"0 Ayush 19" | |
] | |
}, | |
"execution_count": 93, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#inner join\n", | |
"pd.concat([df1,df2],join=\"inner\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 97, | |
"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>Name</th>\n", | |
" <th>Age</th>\n", | |
" <th>study</th>\n", | |
" <th>Name</th>\n", | |
" <th>Age</th>\n", | |
" <th>cricket</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Ankit</td>\n", | |
" <td>18</td>\n", | |
" <td>top</td>\n", | |
" <td>Ayush</td>\n", | |
" <td>19</td>\n", | |
" <td>100</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name Age study Name Age cricket\n", | |
"0 Ankit 18 top Ayush 19 100" | |
] | |
}, | |
"execution_count": 97, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#use axis=0 or axis=1 to join rowwise or columnwise\n", | |
"pd.concat([df1,df2],axis=1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Merge : It works similar like sql join" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 36, | |
"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>Name_x</th>\n", | |
" <th>Age</th>\n", | |
" <th>study</th>\n", | |
" <th>Name_y</th>\n", | |
" <th>cricket</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Ankit</td>\n", | |
" <td>18</td>\n", | |
" <td>top</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>NaN</td>\n", | |
" <td>19</td>\n", | |
" <td>NaN</td>\n", | |
" <td>Ayush</td>\n", | |
" <td>100.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name_x Age study Name_y cricket\n", | |
"0 Ankit 18 top NaN NaN\n", | |
"1 NaN 19 NaN Ayush 100.0" | |
] | |
}, | |
"execution_count": 36, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pd.merge(df1,df2,on=[\"Age\"],how=\"outer\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 35, | |
"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>Name_x</th>\n", | |
" <th>Age</th>\n", | |
" <th>study</th>\n", | |
" <th>Name_y</th>\n", | |
" <th>cricket</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Ankit</td>\n", | |
" <td>18</td>\n", | |
" <td>top</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name_x Age study Name_y cricket\n", | |
"0 Ankit 18 top NaN NaN" | |
] | |
}, | |
"execution_count": 35, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pd.merge(df1,df2,on=[\"Age\"],how=\"left\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import pandas as pd" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Dataset Import\n", | |
"## Reading Csv\n", | |
"### pd.read_csv('file_location')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 83, | |
"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>Unnamed: 0</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>Merc 280C</td>\n", | |
" <td>17.8</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>Toyota Corona</td>\n", | |
" <td>21.5</td>\n", | |
" <td>4</td>\n", | |
" <td>120.1</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Unnamed: 0 mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear carb \n", | |
"0 4 4 \n", | |
"1 4 4 \n", | |
"2 4 1 \n", | |
"3 3 1 \n", | |
"4 3 2 \n", | |
"5 3 1 \n", | |
"6 3 4 \n", | |
"7 4 2 \n", | |
"8 4 2 \n", | |
"9 4 4 \n", | |
"10 4 4 \n", | |
"11 3 3 \n", | |
"12 3 3 \n", | |
"13 3 3 \n", | |
"14 3 4 \n", | |
"15 3 4 \n", | |
"16 3 4 \n", | |
"17 4 1 \n", | |
"18 4 2 \n", | |
"19 4 1 \n", | |
"20 3 1 \n", | |
"21 3 2 \n", | |
"22 3 2 \n", | |
"23 3 4 \n", | |
"24 3 2 \n", | |
"25 4 1 \n", | |
"26 5 2 \n", | |
"27 5 2 \n", | |
"28 5 4 \n", | |
"29 5 6 \n", | |
"30 5 8 \n", | |
"31 4 2 " | |
] | |
}, | |
"execution_count": 83, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cars=pd.read_csv('cars.csv')\n", | |
"cars" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Analysis" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 24, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0 21.0\n", | |
"1 21.0\n", | |
"2 22.8\n", | |
"3 21.4\n", | |
"4 18.7\n", | |
"5 18.1\n", | |
"6 14.3\n", | |
"7 24.4\n", | |
"8 22.8\n", | |
"9 19.2\n", | |
"10 17.8\n", | |
"11 16.4\n", | |
"12 17.3\n", | |
"13 15.2\n", | |
"14 10.4\n", | |
"15 10.4\n", | |
"16 14.7\n", | |
"17 32.4\n", | |
"18 30.4\n", | |
"19 33.9\n", | |
"20 21.5\n", | |
"21 15.5\n", | |
"22 15.2\n", | |
"23 13.3\n", | |
"24 19.2\n", | |
"25 27.3\n", | |
"26 26.0\n", | |
"27 30.4\n", | |
"28 15.8\n", | |
"29 19.7\n", | |
"30 15.0\n", | |
"31 21.4\n", | |
"Name: mpg, dtype: float64" | |
] | |
}, | |
"execution_count": 24, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#accessing a column\n", | |
"cars.mpg" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 26, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#changing datatype of a column\n", | |
"cars.mpg=cars.mpg.astype(str)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 28, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"pandas.core.frame.DataFrame" | |
] | |
}, | |
"execution_count": 28, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#checking the type\n", | |
"type(cars)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 30, | |
"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>Unnamed: 0</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Unnamed: 0 mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 \n", | |
"\n", | |
" carb \n", | |
"0 4 \n", | |
"1 4 \n", | |
"2 1 \n", | |
"3 1 \n", | |
"4 2 " | |
] | |
}, | |
"execution_count": 30, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#view only the first five row - default\n", | |
"cars.head()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"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>Unnamed: 0</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Unnamed: 0 mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 \n", | |
"\n", | |
" carb \n", | |
"0 4 \n", | |
"1 4 \n", | |
"2 1 \n", | |
"3 1 \n", | |
"4 2 \n", | |
"5 1 \n", | |
"6 4 \n", | |
"7 2 \n", | |
"8 2 \n", | |
"9 4 " | |
] | |
}, | |
"execution_count": 41, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cars.head(10)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"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>Unnamed: 0</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.9</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.5</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.5</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.6</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.6</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Unnamed: 0 mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.5 0 1 5 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.5 0 1 5 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.6 0 1 5 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.6 1 1 4 \n", | |
"\n", | |
" carb \n", | |
"27 2 \n", | |
"28 4 \n", | |
"29 6 \n", | |
"30 8 \n", | |
"31 2 " | |
] | |
}, | |
"execution_count": 48, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#view first five from bottom\n", | |
"cars.tail()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 49, | |
"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>Unnamed: 0</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.7</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.9</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.5</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.5</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.6</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.6</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Unnamed: 0 mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.7 0 1 5 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.5 0 1 5 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.5 0 1 5 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.6 0 1 5 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.6 1 1 4 \n", | |
"\n", | |
" carb \n", | |
"26 2 \n", | |
"27 2 \n", | |
"28 4 \n", | |
"29 6 \n", | |
"30 8 \n", | |
"31 2 " | |
] | |
}, | |
"execution_count": 49, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cars.tail(6)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 51, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(32, 12)" | |
] | |
}, | |
"execution_count": 51, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#shape\n", | |
"cars.shape" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 52, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<bound method DataFrame.info of Unnamed: 0 mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear carb \n", | |
"0 4 4 \n", | |
"1 4 4 \n", | |
"2 4 1 \n", | |
"3 3 1 \n", | |
"4 3 2 \n", | |
"5 3 1 \n", | |
"6 3 4 \n", | |
"7 4 2 \n", | |
"8 4 2 \n", | |
"9 4 4 \n", | |
"10 4 4 \n", | |
"11 3 3 \n", | |
"12 3 3 \n", | |
"13 3 3 \n", | |
"14 3 4 \n", | |
"15 3 4 \n", | |
"16 3 4 \n", | |
"17 4 1 \n", | |
"18 4 2 \n", | |
"19 4 1 \n", | |
"20 3 1 \n", | |
"21 3 2 \n", | |
"22 3 2 \n", | |
"23 3 4 \n", | |
"24 3 2 \n", | |
"25 4 1 \n", | |
"26 5 2 \n", | |
"27 5 2 \n", | |
"28 5 4 \n", | |
"29 5 6 \n", | |
"30 5 8 \n", | |
"31 4 2 >" | |
] | |
}, | |
"execution_count": 52, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#prints a cocise info of car\n", | |
"cars.info" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 58, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"<class 'pandas.core.frame.DataFrame'>\n", | |
"RangeIndex: 32 entries, 0 to 31\n", | |
"Data columns (total 12 columns):\n", | |
"Unnamed: 0 32 non-null object\n", | |
"mpg 32 non-null object\n", | |
"cyl 32 non-null int64\n", | |
"disp 32 non-null float64\n", | |
"hp 32 non-null int64\n", | |
"drat 32 non-null float64\n", | |
"wt 32 non-null float64\n", | |
"qsec 32 non-null float64\n", | |
"vs 32 non-null int64\n", | |
"am 32 non-null int64\n", | |
"gear 32 non-null int64\n", | |
"carb 32 non-null int64\n", | |
"dtypes: float64(4), int64(6), object(2)\n", | |
"memory usage: 3.1+ KB\n" | |
] | |
} | |
], | |
"source": [ | |
"#check null counts\n", | |
"cars.info(null_counts=True)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Mathematical Analysis" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 57, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"cyl 6.187500\n", | |
"disp 230.721875\n", | |
"hp 146.687500\n", | |
"drat 3.596563\n", | |
"wt 3.217250\n", | |
"qsec 17.848750\n", | |
"vs 0.437500\n", | |
"am 0.406250\n", | |
"gear 3.687500\n", | |
"carb 2.812500\n", | |
"dtype: float64" | |
] | |
}, | |
"execution_count": 57, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#mean \n", | |
"cars.mean()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 59, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"cyl 6.000\n", | |
"disp 196.300\n", | |
"hp 123.000\n", | |
"drat 3.695\n", | |
"wt 3.325\n", | |
"qsec 17.710\n", | |
"vs 0.000\n", | |
"am 0.000\n", | |
"gear 4.000\n", | |
"carb 2.000\n", | |
"dtype: float64" | |
] | |
}, | |
"execution_count": 59, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#median\n", | |
"cars.median()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 62, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"cyl 1.785922\n", | |
"disp 123.938694\n", | |
"hp 68.562868\n", | |
"drat 0.534679\n", | |
"wt 0.978457\n", | |
"qsec 1.786943\n", | |
"vs 0.504016\n", | |
"am 0.498991\n", | |
"gear 0.737804\n", | |
"carb 1.615200\n", | |
"dtype: float64" | |
] | |
}, | |
"execution_count": 62, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Standard deviation\n", | |
"cars.std()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 64, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Unnamed: 0 AMC Javelin\n", | |
"mpg 10.4\n", | |
"cyl 4\n", | |
"disp 71.1\n", | |
"hp 52\n", | |
"drat 2.76\n", | |
"wt 1.513\n", | |
"qsec 14.5\n", | |
"vs 0\n", | |
"am 0\n", | |
"gear 3\n", | |
"carb 1\n", | |
"dtype: object" | |
] | |
}, | |
"execution_count": 64, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#minimum\n", | |
"cars.min()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 65, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Unnamed: 0 Volvo 142E\n", | |
"mpg 33.9\n", | |
"cyl 8\n", | |
"disp 472\n", | |
"hp 335\n", | |
"drat 4.93\n", | |
"wt 5.424\n", | |
"qsec 22.9\n", | |
"vs 1\n", | |
"am 1\n", | |
"gear 5\n", | |
"carb 8\n", | |
"dtype: object" | |
] | |
}, | |
"execution_count": 65, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#max\n", | |
"cars.max()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 67, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Unnamed: 0 32\n", | |
"mpg 32\n", | |
"cyl 32\n", | |
"disp 32\n", | |
"hp 32\n", | |
"drat 32\n", | |
"wt 32\n", | |
"qsec 32\n", | |
"vs 32\n", | |
"am 32\n", | |
"gear 32\n", | |
"carb 32\n", | |
"dtype: int64" | |
] | |
}, | |
"execution_count": 67, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#count\n", | |
"cars.count()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 70, | |
"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>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>count</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.000000</td>\n", | |
" <td>32.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>mean</td>\n", | |
" <td>6.187500</td>\n", | |
" <td>230.721875</td>\n", | |
" <td>146.687500</td>\n", | |
" <td>3.596563</td>\n", | |
" <td>3.217250</td>\n", | |
" <td>17.848750</td>\n", | |
" <td>0.437500</td>\n", | |
" <td>0.406250</td>\n", | |
" <td>3.687500</td>\n", | |
" <td>2.8125</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>std</td>\n", | |
" <td>1.785922</td>\n", | |
" <td>123.938694</td>\n", | |
" <td>68.562868</td>\n", | |
" <td>0.534679</td>\n", | |
" <td>0.978457</td>\n", | |
" <td>1.786943</td>\n", | |
" <td>0.504016</td>\n", | |
" <td>0.498991</td>\n", | |
" <td>0.737804</td>\n", | |
" <td>1.6152</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>min</td>\n", | |
" <td>4.000000</td>\n", | |
" <td>71.100000</td>\n", | |
" <td>52.000000</td>\n", | |
" <td>2.760000</td>\n", | |
" <td>1.513000</td>\n", | |
" <td>14.500000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.000000</td>\n", | |
" <td>1.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25%</td>\n", | |
" <td>4.000000</td>\n", | |
" <td>120.825000</td>\n", | |
" <td>96.500000</td>\n", | |
" <td>3.080000</td>\n", | |
" <td>2.581250</td>\n", | |
" <td>16.892500</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>3.000000</td>\n", | |
" <td>2.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>50%</td>\n", | |
" <td>6.000000</td>\n", | |
" <td>196.300000</td>\n", | |
" <td>123.000000</td>\n", | |
" <td>3.695000</td>\n", | |
" <td>3.325000</td>\n", | |
" <td>17.710000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>0.000000</td>\n", | |
" <td>4.000000</td>\n", | |
" <td>2.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>75%</td>\n", | |
" <td>8.000000</td>\n", | |
" <td>326.000000</td>\n", | |
" <td>180.000000</td>\n", | |
" <td>3.920000</td>\n", | |
" <td>3.610000</td>\n", | |
" <td>18.900000</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>4.000000</td>\n", | |
" <td>4.0000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>max</td>\n", | |
" <td>8.000000</td>\n", | |
" <td>472.000000</td>\n", | |
" <td>335.000000</td>\n", | |
" <td>4.930000</td>\n", | |
" <td>5.424000</td>\n", | |
" <td>22.900000</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>5.000000</td>\n", | |
" <td>8.0000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" cyl disp hp drat wt qsec \\\n", | |
"count 32.000000 32.000000 32.000000 32.000000 32.000000 32.000000 \n", | |
"mean 6.187500 230.721875 146.687500 3.596563 3.217250 17.848750 \n", | |
"std 1.785922 123.938694 68.562868 0.534679 0.978457 1.786943 \n", | |
"min 4.000000 71.100000 52.000000 2.760000 1.513000 14.500000 \n", | |
"25% 4.000000 120.825000 96.500000 3.080000 2.581250 16.892500 \n", | |
"50% 6.000000 196.300000 123.000000 3.695000 3.325000 17.710000 \n", | |
"75% 8.000000 326.000000 180.000000 3.920000 3.610000 18.900000 \n", | |
"max 8.000000 472.000000 335.000000 4.930000 5.424000 22.900000 \n", | |
"\n", | |
" vs am gear carb \n", | |
"count 32.000000 32.000000 32.000000 32.0000 \n", | |
"mean 0.437500 0.406250 3.687500 2.8125 \n", | |
"std 0.504016 0.498991 0.737804 1.6152 \n", | |
"min 0.000000 0.000000 3.000000 1.0000 \n", | |
"25% 0.000000 0.000000 3.000000 2.0000 \n", | |
"50% 0.000000 0.000000 4.000000 2.0000 \n", | |
"75% 1.000000 1.000000 4.000000 4.0000 \n", | |
"max 1.000000 1.000000 5.000000 8.0000 " | |
] | |
}, | |
"execution_count": 70, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#description : statistics summary\n", | |
"cars.describe()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Cleaning" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 84, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.9</td>\n", | |
" <td>2.62</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am gear carb\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.9 2.62 16.46 0 1 4 4" | |
] | |
}, | |
"execution_count": 84, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#renaming a column\n", | |
"cars=cars.rename(columns={'Unnamed: 0':'Name'})\n", | |
"cars.head(1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 85, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>carb</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>Merc 280C</td>\n", | |
" <td>17.8</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>Toyota Corona</td>\n", | |
" <td>21.5</td>\n", | |
" <td>4</td>\n", | |
" <td>120.1</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>8</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear carb \n", | |
"0 4 4 \n", | |
"1 4 4 \n", | |
"2 4 1 \n", | |
"3 3 1 \n", | |
"4 3 2 \n", | |
"5 3 1 \n", | |
"6 3 4 \n", | |
"7 4 2 \n", | |
"8 4 2 \n", | |
"9 4 4 \n", | |
"10 4 4 \n", | |
"11 3 3 \n", | |
"12 3 3 \n", | |
"13 3 3 \n", | |
"14 3 4 \n", | |
"15 3 4 \n", | |
"16 3 4 \n", | |
"17 4 1 \n", | |
"18 4 2 \n", | |
"19 4 1 \n", | |
"20 3 1 \n", | |
"21 3 2 \n", | |
"22 3 2 \n", | |
"23 3 4 \n", | |
"24 3 2 \n", | |
"25 4 1 \n", | |
"26 5 2 \n", | |
"27 5 2 \n", | |
"28 5 4 \n", | |
"29 5 6 \n", | |
"30 5 8 \n", | |
"31 4 2 " | |
] | |
}, | |
"execution_count": 85, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#flling the mean value\n", | |
"cars.qsec=cars.qsec.fillna(cars.qsec.mean)\n", | |
"cars" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 90, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>Merc 280C</td>\n", | |
" <td>17.8</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>Toyota Corona</td>\n", | |
" <td>21.5</td>\n", | |
" <td>4</td>\n", | |
" <td>120.1</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear \n", | |
"0 4 \n", | |
"1 4 \n", | |
"2 4 \n", | |
"3 3 \n", | |
"4 3 \n", | |
"5 3 \n", | |
"6 3 \n", | |
"7 4 \n", | |
"8 4 \n", | |
"9 4 \n", | |
"10 4 \n", | |
"11 3 \n", | |
"12 3 \n", | |
"13 3 \n", | |
"14 3 \n", | |
"15 3 \n", | |
"16 3 \n", | |
"17 4 \n", | |
"18 4 \n", | |
"19 4 \n", | |
"20 3 \n", | |
"21 3 \n", | |
"22 3 \n", | |
"23 3 \n", | |
"24 3 \n", | |
"25 4 \n", | |
"26 5 \n", | |
"27 5 \n", | |
"28 5 \n", | |
"29 5 \n", | |
"30 5 \n", | |
"31 4 " | |
] | |
}, | |
"execution_count": 90, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Removing Unnecessary columns\n", | |
"#cars=cars.drop(columns=['carb'])\n", | |
"cars" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 92, | |
"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>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>mpg</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>-0.852162</td>\n", | |
" <td>-0.847551</td>\n", | |
" <td>-0.776168</td>\n", | |
" <td>0.681172</td>\n", | |
" <td>-0.867659</td>\n", | |
" <td>0.418684</td>\n", | |
" <td>0.664039</td>\n", | |
" <td>0.599832</td>\n", | |
" <td>0.480285</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>cyl</td>\n", | |
" <td>-0.852162</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>0.902033</td>\n", | |
" <td>0.832447</td>\n", | |
" <td>-0.699938</td>\n", | |
" <td>0.782496</td>\n", | |
" <td>-0.591242</td>\n", | |
" <td>-0.810812</td>\n", | |
" <td>-0.522607</td>\n", | |
" <td>-0.492687</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>disp</td>\n", | |
" <td>-0.847551</td>\n", | |
" <td>0.902033</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>0.790949</td>\n", | |
" <td>-0.710214</td>\n", | |
" <td>0.887980</td>\n", | |
" <td>-0.433698</td>\n", | |
" <td>-0.710416</td>\n", | |
" <td>-0.591227</td>\n", | |
" <td>-0.555569</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>hp</td>\n", | |
" <td>-0.776168</td>\n", | |
" <td>0.832447</td>\n", | |
" <td>0.790949</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>-0.448759</td>\n", | |
" <td>0.658748</td>\n", | |
" <td>-0.708223</td>\n", | |
" <td>-0.723097</td>\n", | |
" <td>-0.243204</td>\n", | |
" <td>-0.125704</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>drat</td>\n", | |
" <td>0.681172</td>\n", | |
" <td>-0.699938</td>\n", | |
" <td>-0.710214</td>\n", | |
" <td>-0.448759</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>-0.712441</td>\n", | |
" <td>0.091205</td>\n", | |
" <td>0.440278</td>\n", | |
" <td>0.712711</td>\n", | |
" <td>0.699610</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>wt</td>\n", | |
" <td>-0.867659</td>\n", | |
" <td>0.782496</td>\n", | |
" <td>0.887980</td>\n", | |
" <td>0.658748</td>\n", | |
" <td>-0.712441</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>-0.174716</td>\n", | |
" <td>-0.554916</td>\n", | |
" <td>-0.692495</td>\n", | |
" <td>-0.583287</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>qsec</td>\n", | |
" <td>0.418684</td>\n", | |
" <td>-0.591242</td>\n", | |
" <td>-0.433698</td>\n", | |
" <td>-0.708223</td>\n", | |
" <td>0.091205</td>\n", | |
" <td>-0.174716</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>0.744535</td>\n", | |
" <td>-0.229861</td>\n", | |
" <td>-0.212682</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>vs</td>\n", | |
" <td>0.664039</td>\n", | |
" <td>-0.810812</td>\n", | |
" <td>-0.710416</td>\n", | |
" <td>-0.723097</td>\n", | |
" <td>0.440278</td>\n", | |
" <td>-0.554916</td>\n", | |
" <td>0.744535</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>0.168345</td>\n", | |
" <td>0.206023</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>am</td>\n", | |
" <td>0.599832</td>\n", | |
" <td>-0.522607</td>\n", | |
" <td>-0.591227</td>\n", | |
" <td>-0.243204</td>\n", | |
" <td>0.712711</td>\n", | |
" <td>-0.692495</td>\n", | |
" <td>-0.229861</td>\n", | |
" <td>0.168345</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>0.794059</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>gear</td>\n", | |
" <td>0.480285</td>\n", | |
" <td>-0.492687</td>\n", | |
" <td>-0.555569</td>\n", | |
" <td>-0.125704</td>\n", | |
" <td>0.699610</td>\n", | |
" <td>-0.583287</td>\n", | |
" <td>-0.212682</td>\n", | |
" <td>0.206023</td>\n", | |
" <td>0.794059</td>\n", | |
" <td>1.000000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" mpg cyl disp hp drat wt qsec \\\n", | |
"mpg 1.000000 -0.852162 -0.847551 -0.776168 0.681172 -0.867659 0.418684 \n", | |
"cyl -0.852162 1.000000 0.902033 0.832447 -0.699938 0.782496 -0.591242 \n", | |
"disp -0.847551 0.902033 1.000000 0.790949 -0.710214 0.887980 -0.433698 \n", | |
"hp -0.776168 0.832447 0.790949 1.000000 -0.448759 0.658748 -0.708223 \n", | |
"drat 0.681172 -0.699938 -0.710214 -0.448759 1.000000 -0.712441 0.091205 \n", | |
"wt -0.867659 0.782496 0.887980 0.658748 -0.712441 1.000000 -0.174716 \n", | |
"qsec 0.418684 -0.591242 -0.433698 -0.708223 0.091205 -0.174716 1.000000 \n", | |
"vs 0.664039 -0.810812 -0.710416 -0.723097 0.440278 -0.554916 0.744535 \n", | |
"am 0.599832 -0.522607 -0.591227 -0.243204 0.712711 -0.692495 -0.229861 \n", | |
"gear 0.480285 -0.492687 -0.555569 -0.125704 0.699610 -0.583287 -0.212682 \n", | |
"\n", | |
" vs am gear \n", | |
"mpg 0.664039 0.599832 0.480285 \n", | |
"cyl -0.810812 -0.522607 -0.492687 \n", | |
"disp -0.710416 -0.591227 -0.555569 \n", | |
"hp -0.723097 -0.243204 -0.125704 \n", | |
"drat 0.440278 0.712711 0.699610 \n", | |
"wt -0.554916 -0.692495 -0.583287 \n", | |
"qsec 0.744535 -0.229861 -0.212682 \n", | |
"vs 1.000000 0.168345 0.206023 \n", | |
"am 0.168345 1.000000 0.794059 \n", | |
"gear 0.206023 0.794059 1.000000 " | |
] | |
}, | |
"execution_count": 92, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#correlation matrix\n", | |
"cars.corr()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 104, | |
"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>cyl</th>\n", | |
" <th>mpg</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>cyl</td>\n", | |
" <td>1.000000</td>\n", | |
" <td>-0.852162</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>mpg</td>\n", | |
" <td>-0.852162</td>\n", | |
" <td>1.000000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" cyl mpg\n", | |
"cyl 1.000000 -0.852162\n", | |
"mpg -0.852162 1.000000" | |
] | |
}, | |
"execution_count": 104, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Find correlation between some columns only\n", | |
"df=cars[['Name','cyl','mpg']].corr()\n", | |
"df\n", | |
"#We can see name is of type string so it didn't come in corr matrix" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 107, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "ValueError", | |
"evalue": "could not convert string to float: 'Mazda RX4'", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", | |
"\u001b[1;32m<ipython-input-107-963fccace553>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mcars\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mName\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfloat\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\generic.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, copy, errors, **kwargs)\u001b[0m\n\u001b[0;32m 5880\u001b[0m \u001b[1;31m# else, only a single dtype is given\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5881\u001b[0m new_data = self._data.astype(\n\u001b[1;32m-> 5882\u001b[1;33m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 5883\u001b[0m )\n\u001b[0;32m 5884\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_constructor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew_data\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__finalize__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, **kwargs)\u001b[0m\n\u001b[0;32m 579\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 580\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 581\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"astype\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 582\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 583\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mconvert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, f, axes, filter, do_integrity_check, consolidate, **kwargs)\u001b[0m\n\u001b[0;32m 436\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mk\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb_items\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0malign_copy\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 437\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 438\u001b[1;33m \u001b[0mapplied\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 439\u001b[0m \u001b[0mresult_blocks\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_extend_blocks\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mapplied\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mresult_blocks\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 440\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\blocks.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, copy, errors, values, **kwargs)\u001b[0m\n\u001b[0;32m 557\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 558\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"raise\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 559\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_astype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 560\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 561\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_astype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"raise\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\internals\\blocks.py\u001b[0m in \u001b[0;36m_astype\u001b[1;34m(self, dtype, copy, errors, values, **kwargs)\u001b[0m\n\u001b[0;32m 641\u001b[0m \u001b[1;31m# _astype_nansafe works fine with 1-d only\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 642\u001b[0m \u001b[0mvals1d\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 643\u001b[1;33m \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mastype_nansafe\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvals1d\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 644\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 645\u001b[0m \u001b[1;31m# TODO(extension)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m~\\Anaconda\\lib\\site-packages\\pandas\\core\\dtypes\\cast.py\u001b[0m in \u001b[0;36mastype_nansafe\u001b[1;34m(arr, dtype, copy, skipna)\u001b[0m\n\u001b[0;32m 727\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcopy\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mis_object_dtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marr\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mis_object_dtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 728\u001b[0m \u001b[1;31m# Explicit copy, or required since NumPy can't view from / to object.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 729\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0marr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 730\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 731\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0marr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mview\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;31mValueError\u001b[0m: could not convert string to float: 'Mazda RX4'" | |
] | |
} | |
], | |
"source": [ | |
"cars.Name.astype(float)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Manipulation" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Indexing\n", | |
"#### By Position" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 109, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0 21.0\n", | |
"1 21.0\n", | |
"2 22.8\n", | |
"3 21.4\n", | |
"4 18.7\n", | |
"5 18.1\n", | |
"6 14.3\n", | |
"7 24.4\n", | |
"8 22.8\n", | |
"9 19.2\n", | |
"10 17.8\n", | |
"11 16.4\n", | |
"12 17.3\n", | |
"13 15.2\n", | |
"14 10.4\n", | |
"15 10.4\n", | |
"16 14.7\n", | |
"17 32.4\n", | |
"18 30.4\n", | |
"19 33.9\n", | |
"20 21.5\n", | |
"21 15.5\n", | |
"22 15.2\n", | |
"23 13.3\n", | |
"24 19.2\n", | |
"25 27.3\n", | |
"26 26.0\n", | |
"27 30.4\n", | |
"28 15.8\n", | |
"29 19.7\n", | |
"30 15.0\n", | |
"31 21.4\n", | |
"Name: mpg, dtype: float64" | |
] | |
}, | |
"execution_count": 109, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#single column\n", | |
"cars.iloc[:,1]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 110, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Name Mazda RX4 Wag\n", | |
"mpg 21\n", | |
"cyl 6\n", | |
"disp 160\n", | |
"hp 110\n", | |
"drat 3.9\n", | |
"wt 2.875\n", | |
"qsec 17.02\n", | |
"vs 0\n", | |
"am 1\n", | |
"gear 4\n", | |
"Name: 1, dtype: object" | |
] | |
}, | |
"execution_count": 110, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#single row\n", | |
"cars.iloc[1,:]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 111, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>Merc 280C</td>\n", | |
" <td>17.8</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>Toyota Corona</td>\n", | |
" <td>21.5</td>\n", | |
" <td>4</td>\n", | |
" <td>120.1</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear \n", | |
"0 4 \n", | |
"1 4 \n", | |
"2 4 \n", | |
"3 3 \n", | |
"4 3 \n", | |
"5 3 \n", | |
"6 3 \n", | |
"7 4 \n", | |
"8 4 \n", | |
"9 4 \n", | |
"10 4 \n", | |
"11 3 \n", | |
"12 3 \n", | |
"13 3 \n", | |
"14 3 \n", | |
"15 3 \n", | |
"16 3 \n", | |
"17 4 \n", | |
"18 4 \n", | |
"19 4 \n", | |
"20 3 \n", | |
"21 3 \n", | |
"22 3 \n", | |
"23 3 \n", | |
"24 3 \n", | |
"25 4 \n", | |
"26 5 \n", | |
"27 5 \n", | |
"28 5 \n", | |
"29 5 \n", | |
"30 5 \n", | |
"31 4 " | |
] | |
}, | |
"execution_count": 111, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#all rows and columns\n", | |
"cars.iloc[:,:]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 113, | |
"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>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" hp drat wt qsec vs am gear\n", | |
"6 245 3.21 3.570 15.84 0 0 3\n", | |
"7 62 3.69 3.190 20.00 1 0 4\n", | |
"8 95 3.92 3.150 22.90 1 0 4\n", | |
"9 123 3.92 3.440 18.30 1 0 4\n", | |
"10 123 3.92 3.440 18.90 1 0 4\n", | |
"11 180 3.07 4.070 17.40 0 0 3\n", | |
"12 180 3.07 3.730 17.60 0 0 3\n", | |
"13 180 3.07 3.780 18.00 0 0 3\n", | |
"14 205 2.93 5.250 17.98 0 0 3\n", | |
"15 215 3.00 5.424 17.82 0 0 3\n", | |
"16 230 3.23 5.345 17.42 0 0 3\n", | |
"17 66 4.08 2.200 19.47 1 1 4\n", | |
"18 52 4.93 1.615 18.52 1 1 4\n", | |
"19 65 4.22 1.835 19.90 1 1 4\n", | |
"20 97 3.70 2.465 20.01 1 0 3\n", | |
"21 150 2.76 3.520 16.87 0 0 3\n", | |
"22 150 3.15 3.435 17.30 0 0 3\n", | |
"23 245 3.73 3.840 15.41 0 0 3\n", | |
"24 175 3.08 3.845 17.05 0 0 3\n", | |
"25 66 4.08 1.935 18.90 1 1 4\n", | |
"26 91 4.43 2.140 16.70 0 1 5\n", | |
"27 113 3.77 1.513 16.90 1 1 5\n", | |
"28 264 4.22 3.170 14.50 0 1 5\n", | |
"29 175 3.62 2.770 15.50 0 1 5\n", | |
"30 335 3.54 3.570 14.60 0 1 5\n", | |
"31 109 4.11 2.780 18.60 1 1 4" | |
] | |
}, | |
"execution_count": 113, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cars.iloc[6:,4:]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### By Label" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 115, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0 21.0\n", | |
"1 21.0\n", | |
"2 22.8\n", | |
"3 21.4\n", | |
"4 18.7\n", | |
"5 18.1\n", | |
"6 14.3\n", | |
"7 24.4\n", | |
"8 22.8\n", | |
"9 19.2\n", | |
"10 17.8\n", | |
"11 16.4\n", | |
"12 17.3\n", | |
"13 15.2\n", | |
"14 10.4\n", | |
"15 10.4\n", | |
"16 14.7\n", | |
"17 32.4\n", | |
"18 30.4\n", | |
"19 33.9\n", | |
"20 21.5\n", | |
"21 15.5\n", | |
"22 15.2\n", | |
"23 13.3\n", | |
"24 19.2\n", | |
"25 27.3\n", | |
"26 26.0\n", | |
"27 30.4\n", | |
"28 15.8\n", | |
"29 19.7\n", | |
"30 15.0\n", | |
"31 21.4\n", | |
"Name: mpg, dtype: float64" | |
] | |
}, | |
"execution_count": 115, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#see all the rows of mpg col\n", | |
"cars.loc[:,'mpg']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 121, | |
"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>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" mpg cyl disp hp drat wt qsec vs am gear\n", | |
"2 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4\n", | |
"3 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3\n", | |
"4 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3" | |
] | |
}, | |
"execution_count": 121, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#loc can take both index or string arg\n", | |
"cars.loc[2:4,'mpg':'gear']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 124, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>5</td>\n", | |
" <td>Valiant</td>\n", | |
" <td>18.1</td>\n", | |
" <td>6</td>\n", | |
" <td>225.0</td>\n", | |
" <td>105</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.460</td>\n", | |
" <td>20.22</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>7</td>\n", | |
" <td>Merc 240D</td>\n", | |
" <td>24.4</td>\n", | |
" <td>4</td>\n", | |
" <td>146.7</td>\n", | |
" <td>62</td>\n", | |
" <td>3.69</td>\n", | |
" <td>3.190</td>\n", | |
" <td>20.00</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>8</td>\n", | |
" <td>Merc 230</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>140.8</td>\n", | |
" <td>95</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.150</td>\n", | |
" <td>22.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>9</td>\n", | |
" <td>Merc 280</td>\n", | |
" <td>19.2</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.30</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>10</td>\n", | |
" <td>Merc 280C</td>\n", | |
" <td>17.8</td>\n", | |
" <td>6</td>\n", | |
" <td>167.6</td>\n", | |
" <td>123</td>\n", | |
" <td>3.92</td>\n", | |
" <td>3.440</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>20</td>\n", | |
" <td>Toyota Corona</td>\n", | |
" <td>21.5</td>\n", | |
" <td>4</td>\n", | |
" <td>120.1</td>\n", | |
" <td>97</td>\n", | |
" <td>3.70</td>\n", | |
" <td>2.465</td>\n", | |
" <td>20.01</td>\n", | |
" <td>1</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>31</td>\n", | |
" <td>Volvo 142E</td>\n", | |
" <td>21.4</td>\n", | |
" <td>4</td>\n", | |
" <td>121.0</td>\n", | |
" <td>109</td>\n", | |
" <td>4.11</td>\n", | |
" <td>2.780</td>\n", | |
" <td>18.60</td>\n", | |
" <td>1</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"5 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"7 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 \n", | |
"8 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 \n", | |
"9 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 \n", | |
"10 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 \n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 \n", | |
"20 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"31 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 \n", | |
"\n", | |
" gear gm \n", | |
"0 4 1 \n", | |
"1 4 1 \n", | |
"2 4 1 \n", | |
"3 3 1 \n", | |
"4 3 1 \n", | |
"5 3 1 \n", | |
"6 3 1 \n", | |
"7 4 1 \n", | |
"8 4 1 \n", | |
"9 4 1 \n", | |
"10 4 1 \n", | |
"11 3 1 \n", | |
"12 3 1 \n", | |
"13 3 1 \n", | |
"14 3 1 \n", | |
"15 3 1 \n", | |
"16 3 1 \n", | |
"17 4 1 \n", | |
"18 4 1 \n", | |
"19 4 1 \n", | |
"20 3 1 \n", | |
"21 3 1 \n", | |
"22 3 1 \n", | |
"23 3 1 \n", | |
"24 3 1 \n", | |
"25 4 1 \n", | |
"26 5 1 \n", | |
"27 5 1 \n", | |
"28 5 1 \n", | |
"29 5 1 \n", | |
"30 5 1 \n", | |
"31 4 1 " | |
] | |
}, | |
"execution_count": 124, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#set values of column to a value\n", | |
"cars['gm']=1\n", | |
"cars" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 126, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>11</td>\n", | |
" <td>Merc 450SE</td>\n", | |
" <td>16.4</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>4.070</td>\n", | |
" <td>17.40</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>12</td>\n", | |
" <td>Merc 450SL</td>\n", | |
" <td>17.3</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.730</td>\n", | |
" <td>17.60</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>13</td>\n", | |
" <td>Merc 450SLC</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>275.8</td>\n", | |
" <td>180</td>\n", | |
" <td>3.07</td>\n", | |
" <td>3.780</td>\n", | |
" <td>18.00</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>21</td>\n", | |
" <td>Dodge Challenger</td>\n", | |
" <td>15.5</td>\n", | |
" <td>8</td>\n", | |
" <td>318.0</td>\n", | |
" <td>150</td>\n", | |
" <td>2.76</td>\n", | |
" <td>3.520</td>\n", | |
" <td>16.87</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>22</td>\n", | |
" <td>AMC Javelin</td>\n", | |
" <td>15.2</td>\n", | |
" <td>8</td>\n", | |
" <td>304.0</td>\n", | |
" <td>150</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.435</td>\n", | |
" <td>17.30</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>24</td>\n", | |
" <td>Pontiac Firebird</td>\n", | |
" <td>19.2</td>\n", | |
" <td>8</td>\n", | |
" <td>400.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.845</td>\n", | |
" <td>17.05</td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>26</td>\n", | |
" <td>Porsche 914-2</td>\n", | |
" <td>26.0</td>\n", | |
" <td>4</td>\n", | |
" <td>120.3</td>\n", | |
" <td>91</td>\n", | |
" <td>4.43</td>\n", | |
" <td>2.140</td>\n", | |
" <td>16.70</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>28</td>\n", | |
" <td>Ford Pantera L</td>\n", | |
" <td>15.8</td>\n", | |
" <td>8</td>\n", | |
" <td>351.0</td>\n", | |
" <td>264</td>\n", | |
" <td>4.22</td>\n", | |
" <td>3.170</td>\n", | |
" <td>14.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>29</td>\n", | |
" <td>Ferrari Dino</td>\n", | |
" <td>19.7</td>\n", | |
" <td>6</td>\n", | |
" <td>145.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.62</td>\n", | |
" <td>2.770</td>\n", | |
" <td>15.50</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>30</td>\n", | |
" <td>Maserati Bora</td>\n", | |
" <td>15.0</td>\n", | |
" <td>8</td>\n", | |
" <td>301.0</td>\n", | |
" <td>335</td>\n", | |
" <td>3.54</td>\n", | |
" <td>3.570</td>\n", | |
" <td>14.60</td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 \n", | |
"11 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 \n", | |
"12 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 \n", | |
"13 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 \n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 \n", | |
"21 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 \n", | |
"22 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 \n", | |
"24 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 \n", | |
"26 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 \n", | |
"28 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 \n", | |
"29 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 \n", | |
"30 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 \n", | |
"\n", | |
" gear gm \n", | |
"0 4 1 \n", | |
"1 4 1 \n", | |
"4 3 1 \n", | |
"6 3 1 \n", | |
"11 3 1 \n", | |
"12 3 1 \n", | |
"13 3 1 \n", | |
"14 3 1 \n", | |
"15 3 1 \n", | |
"16 3 1 \n", | |
"21 3 1 \n", | |
"22 3 1 \n", | |
"23 3 1 \n", | |
"24 3 1 \n", | |
"26 5 1 \n", | |
"28 5 1 \n", | |
"29 5 1 \n", | |
"30 5 1 " | |
] | |
}, | |
"execution_count": 126, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#filtering\n", | |
"cars[cars['vs']==0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 133, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>5</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 4 1 4 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 4 1 4 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 5 1 4 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 5 0 3 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 4 0 3 \n", | |
"\n", | |
" gm \n", | |
"0 1 \n", | |
"1 1 \n", | |
"2 1 \n", | |
"3 1 \n", | |
"4 1 " | |
] | |
}, | |
"execution_count": 133, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Applying lambda function\n", | |
"f=lambda x:x+2\n", | |
"cars['vs']=cars['vs'].apply(f)\n", | |
"cars.head()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 134, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" <th>2am</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>0</td>\n", | |
" <td>Mazda RX4</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.620</td>\n", | |
" <td>16.46</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>1</td>\n", | |
" <td>Mazda RX4 Wag</td>\n", | |
" <td>21.0</td>\n", | |
" <td>6</td>\n", | |
" <td>160.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.90</td>\n", | |
" <td>2.875</td>\n", | |
" <td>17.02</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>2</td>\n", | |
" <td>Datsun 710</td>\n", | |
" <td>22.8</td>\n", | |
" <td>4</td>\n", | |
" <td>108.0</td>\n", | |
" <td>93</td>\n", | |
" <td>3.85</td>\n", | |
" <td>2.320</td>\n", | |
" <td>18.61</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>3</td>\n", | |
" <td>Hornet 4 Drive</td>\n", | |
" <td>21.4</td>\n", | |
" <td>6</td>\n", | |
" <td>258.0</td>\n", | |
" <td>110</td>\n", | |
" <td>3.08</td>\n", | |
" <td>3.215</td>\n", | |
" <td>19.44</td>\n", | |
" <td>5</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>4</td>\n", | |
" <td>Hornet Sportabout</td>\n", | |
" <td>18.7</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>175</td>\n", | |
" <td>3.15</td>\n", | |
" <td>3.440</td>\n", | |
" <td>17.02</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"0 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 4 1 4 \n", | |
"1 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 4 1 4 \n", | |
"2 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 5 1 4 \n", | |
"3 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 5 0 3 \n", | |
"4 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 4 0 3 \n", | |
"\n", | |
" gm 2am \n", | |
"0 1 3 \n", | |
"1 1 3 \n", | |
"2 1 3 \n", | |
"3 1 2 \n", | |
"4 1 2 " | |
] | |
}, | |
"execution_count": 134, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#creating new column and applying lambda function\n", | |
"cars['2am']=cars['am'].apply(f)\n", | |
"cars.head()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Sorting" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 145, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" <th>2am</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>15</td>\n", | |
" <td>Lincoln Continental</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>460.0</td>\n", | |
" <td>215</td>\n", | |
" <td>3.00</td>\n", | |
" <td>5.424</td>\n", | |
" <td>17.82</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>14</td>\n", | |
" <td>Cadillac Fleetwood</td>\n", | |
" <td>10.4</td>\n", | |
" <td>8</td>\n", | |
" <td>472.0</td>\n", | |
" <td>205</td>\n", | |
" <td>2.93</td>\n", | |
" <td>5.250</td>\n", | |
" <td>17.98</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>23</td>\n", | |
" <td>Camaro Z28</td>\n", | |
" <td>13.3</td>\n", | |
" <td>8</td>\n", | |
" <td>350.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.73</td>\n", | |
" <td>3.840</td>\n", | |
" <td>15.41</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>6</td>\n", | |
" <td>Duster 360</td>\n", | |
" <td>14.3</td>\n", | |
" <td>8</td>\n", | |
" <td>360.0</td>\n", | |
" <td>245</td>\n", | |
" <td>3.21</td>\n", | |
" <td>3.570</td>\n", | |
" <td>15.84</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>16</td>\n", | |
" <td>Chrysler Imperial</td>\n", | |
" <td>14.7</td>\n", | |
" <td>8</td>\n", | |
" <td>440.0</td>\n", | |
" <td>230</td>\n", | |
" <td>3.23</td>\n", | |
" <td>5.345</td>\n", | |
" <td>17.42</td>\n", | |
" <td>4</td>\n", | |
" <td>0</td>\n", | |
" <td>3</td>\n", | |
" <td>1</td>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am \\\n", | |
"15 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 4 0 \n", | |
"14 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 4 0 \n", | |
"23 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 4 0 \n", | |
"6 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 4 0 \n", | |
"16 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 4 0 \n", | |
"\n", | |
" gear gm 2am \n", | |
"15 3 1 2 \n", | |
"14 3 1 2 \n", | |
"23 3 1 2 \n", | |
"6 3 1 2 \n", | |
"16 3 1 2 " | |
] | |
}, | |
"execution_count": 145, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#sort by value of a column\n", | |
"cars=cars.sort_values(by='mpg')\n", | |
"cars.head()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 151, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" <th>2am</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>18</td>\n", | |
" <td>Honda Civic</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>75.7</td>\n", | |
" <td>52</td>\n", | |
" <td>4.93</td>\n", | |
" <td>1.615</td>\n", | |
" <td>18.52</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>27</td>\n", | |
" <td>Lotus Europa</td>\n", | |
" <td>30.4</td>\n", | |
" <td>4</td>\n", | |
" <td>95.1</td>\n", | |
" <td>113</td>\n", | |
" <td>3.77</td>\n", | |
" <td>1.513</td>\n", | |
" <td>16.90</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>25</td>\n", | |
" <td>Fiat X1-9</td>\n", | |
" <td>27.3</td>\n", | |
" <td>4</td>\n", | |
" <td>79.0</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>1.935</td>\n", | |
" <td>18.90</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am gear \\\n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 5 1 4 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 5 1 4 \n", | |
"18 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 5 1 4 \n", | |
"27 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 5 1 5 \n", | |
"25 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 5 1 4 \n", | |
"\n", | |
" gm 2am \n", | |
"19 1 3 \n", | |
"17 1 3 \n", | |
"18 1 3 \n", | |
"27 1 3 \n", | |
"25 1 3 " | |
] | |
}, | |
"execution_count": 151, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#sort in descending order\n", | |
"cars=cars.sort_values(by='mpg',ascending=False)\n", | |
"cars.head()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Filtering" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 157, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"19 True\n", | |
"17 True\n", | |
"18 True\n", | |
"27 True\n", | |
"25 False\n", | |
"26 False\n", | |
"7 False\n", | |
"2 False\n", | |
"8 False\n", | |
"20 False\n", | |
"31 False\n", | |
"3 False\n", | |
"0 False\n", | |
"1 False\n", | |
"29 False\n", | |
"24 False\n", | |
"9 False\n", | |
"4 False\n", | |
"5 False\n", | |
"10 False\n", | |
"12 False\n", | |
"11 False\n", | |
"28 False\n", | |
"21 False\n", | |
"13 False\n", | |
"22 False\n", | |
"30 False\n", | |
"16 False\n", | |
"6 False\n", | |
"23 False\n", | |
"14 False\n", | |
"15 False\n", | |
"Name: mpg, dtype: bool" | |
] | |
}, | |
"execution_count": 157, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#filtering\n", | |
"cars['mpg']>30" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 170, | |
"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>Name</th>\n", | |
" <th>mpg</th>\n", | |
" <th>cyl</th>\n", | |
" <th>disp</th>\n", | |
" <th>hp</th>\n", | |
" <th>drat</th>\n", | |
" <th>wt</th>\n", | |
" <th>qsec</th>\n", | |
" <th>vs</th>\n", | |
" <th>am</th>\n", | |
" <th>gear</th>\n", | |
" <th>gm</th>\n", | |
" <th>2am</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <td>19</td>\n", | |
" <td>Toyota Corolla</td>\n", | |
" <td>33.9</td>\n", | |
" <td>4</td>\n", | |
" <td>71.1</td>\n", | |
" <td>65</td>\n", | |
" <td>4.22</td>\n", | |
" <td>1.835</td>\n", | |
" <td>19.90</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <td>17</td>\n", | |
" <td>Fiat 128</td>\n", | |
" <td>32.4</td>\n", | |
" <td>4</td>\n", | |
" <td>78.7</td>\n", | |
" <td>66</td>\n", | |
" <td>4.08</td>\n", | |
" <td>2.200</td>\n", | |
" <td>19.47</td>\n", | |
" <td>5</td>\n", | |
" <td>1</td>\n", | |
" <td>4</td>\n", | |
" <td>1</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" Name mpg cyl disp hp drat wt qsec vs am gear gm \\\n", | |
"19 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 5 1 4 1 \n", | |
"17 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 5 1 4 1 \n", | |
"\n", | |
" 2am \n", | |
"19 3 \n", | |
"17 3 " | |
] | |
}, | |
"execution_count": 170, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#filter array with multiple conditions\n", | |
"filters=(cars['mpg']>30)&(cars['qsec']>19)\n", | |
"#Applying filter to car\n", | |
"new_cars=cars[filters]\n", | |
"#view filtered data\n", | |
"new_cars\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Visualization" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 175, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[<matplotlib.lines.Line2D at 0x21d48c74d08>]" | |
] | |
}, | |
"execution_count": 175, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iV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xjSF1rutlQM/BP4GPAPkAzuAq5xzIfsm4Qn2YQqt/2R3wDbg5o/GkkORmZ0NvAusAloCm++mdQzZF8fiJPswA58cCzMbReublNG0nvw+45z7ceDP91wgHfgAuN45V98jmfxQ4CIi8ml+GEIREZHjUIGLiPiUClxExKdU4CIiPqUCFxHxKRW4iIhPqcBFRHxKBS4i4lP/B0mYZJddX/TDAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"#import matplotlib\n", | |
"import matplotlib.pyplot as plt\n", | |
"%matplotlib inline\n", | |
"y1=cars['mpg']\n", | |
"x=range(32)\n", | |
"plt.plot(x,y1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 177, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[<matplotlib.lines.Line2D at 0x21d48d6efc8>]" | |
] | |
}, | |
"execution_count": 177, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXjc5XXo8e/Rvu+LZS2WZctgMF7ANZvNEkhCyOK0TVq4TUoSCJCQNG3ae5M2zU23tLS3TZo8vdeEBBqSNFCapZCFEEIA4wA2Ml7whiXLkiUvWkfrSJrRzHv/mN/IY2tGs2o2nc/z6NHoN4ve8cDR+5z3vOcVYwxKKaXSS0aiB6CUUir2NLgrpVQa0uCulFJpSIO7UkqlIQ3uSimVhrISPQCAqqoq09zcnOhhKKVUStm7d++gMaba331J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5wB57zW1PGAufQpqKUPzvXGxAtv02SfxbWQt4jwFFjzFd87kqZzyLQe0ilz0JEqkWkzLqdD9yKZ+3gBeAD1sPi/jmkbLUMgFUe9a9AJvCoMebLCR5SWESkBc9sHc6fQ5v070FEHgduwtPStA/4EvDfwJNAE9bZucaYpF2wDPAebsKTBjBAF3CfN3edjERkK/Ay8Cbgti7/BZ6cdUp8Fgu8hztJkc9CRNbjWTDNxDNhftIY8zfW/99PABXAPuBDxpiZuI0rlYO7Ukop/1I5LaOUUioADe5KKZWGNLgrpVQa0uCulFJpSIO7UkqlIQ3uSimVhjS4K6VUGvr/VslJGEtK1asAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"#plotting curve\n", | |
"y2=cars['hp']\n", | |
"plt.plot(x,y2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 180, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"No handles with labels found to put in legend.\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"<matplotlib.legend.Legend at 0x21d49e7d208>" | |
] | |
}, | |
"execution_count": 180, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXxcZb348c93lizN0jZpuiahW2ihBQqGUkQBCyoUr4AsoqjIRVEvuP30/twVF+7P63r1CipeUFAUK4sgcllaKFAEpIXShbYQ2rRNmzbpmqVZJj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80Z0X4DnnFGNNqjHnZed4JbMZWX82bv8Uo3yFvGKvLeel1HgZYCtzrrM/43yGfg3uhlBU2wOMislZErs92Y5IwxRjTCvYfLDA5y+1J1I0ist5J2+RsOmM4EZkJnAq8SJ7+LYZ9B8ijv4WIuEVkHdAGPAG8CRw2xgw4m2Q8PuVzcI9aVjhPnGWMOQ07a9UNTrpAZccvgTnAIqAV+HF2mxMbESkH7gM+Z4zpyHZ7EhHmO+TV38IY4zfGLMJWwF0MnBBus0y2KZ+De9SywvnAGLPHWbYBD2D/x8hH+5z8aTCP2pbl9sTNGLPP+UcaAH5DHvwtnBzvfcDdxpj7ndV59bcI9x3y8W8BYIw5DKwClgATRCRYnDHj8Smfg3velxUWkTLnJhIiUga8C9g4+l456yHgGuf5NcCDWWxLQoIB0XEpOf63cG7k3Q5sNsb8JOStvPlbRPoO+fS3EJEaEZngPC8FzsfeO3gKuNzZLON/h7ztLQPgdI/6L4bKCt+c5SbFRURmY6/WwZZf/mM+fAcR+RNwLrbq3T7gW8BfgeVAPbATuMIYk7M3LCN8h3OxaQADNAOfCOauc5GIvA14FtgABJzVX8XmrPPibzHKd/gAefK3EJGTsTdM3dgL5uXGmO84/77vAaqAV4APGWP6MtaufA7uSimlwsvntIxSSqkINLgrpVQB0uCulFIFSIO7UkoVIA3uSilVgDS4K6VUAdLgrpRSBUiDu1JKFaD/D4I34kMHREHHAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"#plotting 2 curve\n", | |
"plt.plot(x,y1)\n", | |
"plt.plot(x,y2)\n", | |
"plt.legend()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.7.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment