You are on page 1of 29

{

"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"id": "M0h-eVYGpXNq"
},
"outputs": [],
"source": [
"import numpy "
]
},
{
"cell_type": "code",
"source": [
"import numpy as np"
],
"metadata": {
"id": "LnTy1d-KpwGH"
},
"execution_count": 2,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import pandas"
],
"metadata": {
"id": "mCpcIkXRpy9a"
},
"execution_count": 3,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import pandas as pd"
],
"metadata": {
"id": "geROCH_opz-_"
},
"execution_count": 4,
"outputs": []
},
{
"cell_type": "code",
"source": [
"data = pd.read_csv('cars.csv')"
],
"metadata": {
"id": "_m2t8rbuqAZt"
},
"execution_count": 6,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"parsed our data "
],
"metadata": {
"id": "B-dM0KoqDXcX"
}
},
{
"cell_type": "code",
"source": [
"data"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 602
},
"id": "_-eHPAiUqXi3",
"outputId": "dc3063da-068c-4617-8dc7-35f1bc7e79f5"
},
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Customer Name Customer e-
mail \\\n",
"0 Martina Avila
cubilia.Curae.Phasellus@quisaccumsanconvallis.edu \n",
"1 Harlan Barnes
eu.dolor@diam.co.uk \n",
"2 Naomi Rodriquez
vulputate.mauris.sagittis@ametconsectetueradip... \n",
"3 Jade Cunningham
malesuada@dignissim.com \n",
"4 Cedric Leach
felis.ullamcorper.viverra@egetmollislectus.net \n",

".. ... ... \n",


"495 Walter
ligula@Cumsociis.ca \n",
"496 Vanna
Cum.sociis.natoque@Sedmolestie.edu \n",
"497 Pearl
penatibus.et@massanonante.com \n",
"498 Nell
Quisque.varius@arcuVivamussit.net \n",
"499 Marla
Camaron.marla@hotmail.com \n",
"\n",
" Country Gender Age Annual Salary Credit Card Debt Net
Worth \\\n",
"0 USA 0 42 62812.09301 11609.380910
238961.2505 \n",
"1 USA 0 41 66646.89292 9572.957136
530973.9078 \n",
"2 USA 1 43 53798.55112 11160.355060
638467.1773 \n",
"3 USA 1 58 79370.03798 14426.164850
548599.0524 \n",
"4 USA 1 57 59729.15130 5358.712177
560304.0671 \n",

".. ... ... ... ... ... ... \n",


"495 USA 0 41 71942.40291 6995.902524
541670.1016 \n",
"496 USA 1 38 56039.49793 12301.456790
360419.0988 \n",
"497 USA 1 54 68888.77805 10611.606860
764531.3203 \n",
"498 USA 1 59 49811.99062 14013.034510
337826.6382 \n",
"499 USA 1 47 61370.67766 9391.341628
462946.4924 \n",
"\n",
" Car Purchase Amount \n",
"0 35321.45877 \n",
"1 45115.52566 \n",
"2 42925.70921 \n",
"3 67422.36313 \n",
"4 55915.46248 \n",
".. ... \n",
"495 48901.44342 \n",
"496 31491.41457 \n",
"497 64147.28888 \n",
"498 45442.15353 \n",
"499 45107.22566 \n",
"\n",
"[500 rows x 9 columns]"
],
"text/html": [
"\n",
" <div id=\"df-1fd9d720-f5b5-42ae-8d39-1463ec937d0c\">\n",
" <div class=\"colab-df-container\">\n",
" <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>Customer Name</th>\n",
" <th>Customer e-mail</th>\n",
" <th>Country</th>\n",
" <th>Gender</th>\n",
" <th>Age</th>\n",
" <th>Annual Salary</th>\n",
" <th>Credit Card Debt</th>\n",
" <th>Net Worth</th>\n",
" <th>Car Purchase Amount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Martina Avila</td>\n",
" <td>cubilia.Curae.Phasellus@quisaccumsanconvallis.edu</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>42</td>\n",
" <td>62812.09301</td>\n",
" <td>11609.380910</td>\n",
" <td>238961.2505</td>\n",
" <td>35321.45877</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Harlan Barnes</td>\n",
" <td>eu.dolor@diam.co.uk</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>41</td>\n",
" <td>66646.89292</td>\n",
" <td>9572.957136</td>\n",
" <td>530973.9078</td>\n",
" <td>45115.52566</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Naomi Rodriquez</td>\n",
" <td>vulputate.mauris.sagittis@ametconsectetueradip...</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>43</td>\n",
" <td>53798.55112</td>\n",
" <td>11160.355060</td>\n",
" <td>638467.1773</td>\n",
" <td>42925.70921</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Jade Cunningham</td>\n",
" <td>malesuada@dignissim.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>58</td>\n",
" <td>79370.03798</td>\n",
" <td>14426.164850</td>\n",
" <td>548599.0524</td>\n",
" <td>67422.36313</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Cedric Leach</td>\n",
" <td>felis.ullamcorper.viverra@egetmollislectus.net</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>57</td>\n",
" <td>59729.15130</td>\n",
" <td>5358.712177</td>\n",
" <td>560304.0671</td>\n",
" <td>55915.46248</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>495</th>\n",
" <td>Walter</td>\n",
" <td>ligula@Cumsociis.ca</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>41</td>\n",
" <td>71942.40291</td>\n",
" <td>6995.902524</td>\n",
" <td>541670.1016</td>\n",
" <td>48901.44342</td>\n",
" </tr>\n",
" <tr>\n",
" <th>496</th>\n",
" <td>Vanna</td>\n",
" <td>Cum.sociis.natoque@Sedmolestie.edu</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>38</td>\n",
" <td>56039.49793</td>\n",
" <td>12301.456790</td>\n",
" <td>360419.0988</td>\n",
" <td>31491.41457</td>\n",
" </tr>\n",
" <tr>\n",
" <th>497</th>\n",
" <td>Pearl</td>\n",
" <td>penatibus.et@massanonante.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>54</td>\n",
" <td>68888.77805</td>\n",
" <td>10611.606860</td>\n",
" <td>764531.3203</td>\n",
" <td>64147.28888</td>\n",
" </tr>\n",
" <tr>\n",
" <th>498</th>\n",
" <td>Nell</td>\n",
" <td>Quisque.varius@arcuVivamussit.net</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>59</td>\n",
" <td>49811.99062</td>\n",
" <td>14013.034510</td>\n",
" <td>337826.6382</td>\n",
" <td>45442.15353</td>\n",
" </tr>\n",
" <tr>\n",
" <th>499</th>\n",
" <td>Marla</td>\n",
" <td>Camaron.marla@hotmail.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>47</td>\n",
" <td>61370.67766</td>\n",
" <td>9391.341628</td>\n",
" <td>462946.4924</td>\n",
" <td>45107.22566</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>500 rows × 9 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\"
onclick=\"convertToInteractive('df-1fd9d720-f5b5-42ae-8d39-1463ec937d0c')\"\n",
" title=\"Convert this dataframe to an interactive
table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\"
height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-
2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-
2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94
2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-
1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59
1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4
18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px
rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-1fd9d720-f5b5-42ae-8d39-
1463ec937d0c button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-1fd9d720-f5b5-
42ae-8d39-1463ec937d0c');\n",
" const dataTable =\n",
" await
google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\"
href=https://colab.research.google.com/notebooks/data_table.ipynb>data table
notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable,
element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 7
}
]
},
{
"cell_type": "markdown",
"source": [
"Here is our downloaded table "
],
"metadata": {
"id": "7jeCtDEYDwEk"
}
},
{
"cell_type": "code",
"source": [
"data.ndim"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "s-r0c_yeq4yT",
"outputId": "bec8959c-21c6-49b4-a873-b8d493bbbf0e"
},
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"2"
]
},
"metadata": {},
"execution_count": 8
}
]
},
{
"cell_type": "markdown",
"source": [
"through this formula we found how many dimensions it has"
],
"metadata": {
"id": "gYXZhmgfD5BW"
}
},
{
"cell_type": "code",
"source": [
"data.size"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "KaGNT9oFsn4M",
"outputId": "f4f92c7f-cb87-48bf-811b-f94367b58656"
},
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"4500"
]
},
"metadata": {},
"execution_count": 9
}
]
},
{
"cell_type": "markdown",
"source": [
"returns the number of elements in the DataFrame"
],
"metadata": {
"id": "8qnA5uiDEIKz"
}
},
{
"cell_type": "code",
"source": [
"data.info"
],
"metadata": {
"id": "4FdBmrLHxRBZ",
"outputId": "6a011f5a-8c73-4089-9d5a-65638b2b6af7",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<bound method DataFrame.info of Customer Name
Customer e-mail \\\n",
"0 Martina Avila
cubilia.Curae.Phasellus@quisaccumsanconvallis.edu \n",
"1 Harlan Barnes
eu.dolor@diam.co.uk \n",
"2 Naomi Rodriquez
vulputate.mauris.sagittis@ametconsectetueradip... \n",
"3 Jade Cunningham
malesuada@dignissim.com \n",
"4 Cedric Leach
felis.ullamcorper.viverra@egetmollislectus.net \n",

".. ... ... \n",


"495 Walter
ligula@Cumsociis.ca \n",
"496 Vanna
Cum.sociis.natoque@Sedmolestie.edu \n",
"497 Pearl
penatibus.et@massanonante.com \n",
"498 Nell
Quisque.varius@arcuVivamussit.net \n",
"499 Marla
Camaron.marla@hotmail.com \n",
"\n",
" Country Gender Age Annual Salary Credit Card Debt Net
Worth \\\n",
"0 USA 0 42 62812.09301 11609.380910
238961.2505 \n",
"1 USA 0 41 66646.89292 9572.957136
530973.9078 \n",
"2 USA 1 43 53798.55112 11160.355060
638467.1773 \n",
"3 USA 1 58 79370.03798 14426.164850
548599.0524 \n",
"4 USA 1 57 59729.15130 5358.712177
560304.0671 \n",

".. ... ... ... ... ... ... \n",


"495 USA 0 41 71942.40291 6995.902524
541670.1016 \n",
"496 USA 1 38 56039.49793 12301.456790
360419.0988 \n",
"497 USA 1 54 68888.77805 10611.606860
764531.3203 \n",
"498 USA 1 59 49811.99062 14013.034510
337826.6382 \n",
"499 USA 1 47 61370.67766 9391.341628
462946.4924 \n",
"\n",
" Car Purchase Amount \n",
"0 35321.45877 \n",
"1 45115.52566 \n",
"2 42925.70921 \n",
"3 67422.36313 \n",
"4 55915.46248 \n",
".. ... \n",
"495 48901.44342 \n",
"496 31491.41457 \n",
"497 64147.28888 \n",
"498 45442.15353 \n",
"499 45107.22566 \n",
"\n",
"[500 rows x 9 columns]>"
]
},
"metadata": {},
"execution_count": 10
}
]
},
{
"cell_type": "markdown",
"source": [
"We printed information about the number of columns, column labels, column
data types, memory usage,etc"
],
"metadata": {
"id": "Ai2R7J79ETi9"
}
},
{
"cell_type": "code",
"source": [
"data.shape"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "is9bab3Rs0TE",
"outputId": "4fb7dd4b-4840-4446-dfcf-a61cb92f3a37"
},
"execution_count": 11,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"(500, 9)"
]
},
"metadata": {},
"execution_count": 11
}
]
},
{
"cell_type": "markdown",
"source": [
"'.shape' shows how many columns and rows we have"
],
"metadata": {
"id": "TCzA4z89ExwJ"
}
},
{
"cell_type": "code",
"source": [
"data['Age'].value_counts()\n",
"data1 = data['Age'].value_counts()\n",
"data1.tail()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "qi5LkcsIyJUS",
"outputId": "748802af-1842-40ae-945a-b65f66e24300"
},
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"22 1\n",
"65 1\n",
"64 1\n",
"28 1\n",
"25 1\n",
"Name: Age, dtype: int64"
]
},
"metadata": {},
"execution_count": 12
}
]
},
{
"cell_type": "markdown",
"source": [
"We found 5 ages that occur the least "
],
"metadata": {
"id": "8eqJ57i8E65N"
}
},
{
"cell_type": "code",
"source": [
"data.groupby('Gender')['Age'].min()"
],
"metadata": {
"id": "tuAklxKWz3M4",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "538d7b10-469c-4804-ef69-7a9902dc0a9e"
},
"execution_count": 13,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Gender\n",
"0 25\n",
"1 20\n",
"Name: Age, dtype: int64"
]
},
"metadata": {},
"execution_count": 13
}
]
},
{
"cell_type": "markdown",
"source": [
"while here we found the youngest male and female through the function
'groupby'"
],
"metadata": {
"id": "TI-mrod_FWKh"
}
},
{
"cell_type": "code",
"source": [
"data = data.dropna()"
],
"metadata": {
"id": "QbVWJQAEB6-V"
},
"execution_count": 18,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"printed our DataFrame without null values"
],
"metadata": {
"id": "XyedRLUOFi05"
}
},
{
"cell_type": "code",
"source": [
"data"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 602
},
"id": "XYqBkeSWCHKs",
"outputId": "fcb7b0fb-ef83-45d0-b6de-3273e9c91373"
},
"execution_count": 20,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Customer Name Customer e-
mail \\\n",
"0 Martina Avila
cubilia.Curae.Phasellus@quisaccumsanconvallis.edu \n",
"1 Harlan Barnes
eu.dolor@diam.co.uk \n",
"2 Naomi Rodriquez
vulputate.mauris.sagittis@ametconsectetueradip... \n",
"3 Jade Cunningham
malesuada@dignissim.com \n",
"4 Cedric Leach
felis.ullamcorper.viverra@egetmollislectus.net \n",

".. ... ... \n",


"495 Walter
ligula@Cumsociis.ca \n",
"496 Vanna
Cum.sociis.natoque@Sedmolestie.edu \n",
"497 Pearl
penatibus.et@massanonante.com \n",
"498 Nell
Quisque.varius@arcuVivamussit.net \n",
"499 Marla
Camaron.marla@hotmail.com \n",
"\n",
" Country Gender Age Annual Salary Credit Card Debt Net
Worth \\\n",
"0 USA 0 42 62812.09301 11609.380910
238961.2505 \n",
"1 USA 0 41 66646.89292 9572.957136
530973.9078 \n",
"2 USA 1 43 53798.55112 11160.355060
638467.1773 \n",
"3 USA 1 58 79370.03798 14426.164850
548599.0524 \n",
"4 USA 1 57 59729.15130 5358.712177
560304.0671 \n",

".. ... ... ... ... ... ... \n",


"495 USA 0 41 71942.40291 6995.902524
541670.1016 \n",
"496 USA 1 38 56039.49793 12301.456790
360419.0988 \n",
"497 USA 1 54 68888.77805 10611.606860
764531.3203 \n",
"498 USA 1 59 49811.99062 14013.034510
337826.6382 \n",
"499 USA 1 47 61370.67766 9391.341628
462946.4924 \n",
"\n",
" Car Purchase Amount \n",
"0 35321.45877 \n",
"1 45115.52566 \n",
"2 42925.70921 \n",
"3 67422.36313 \n",
"4 55915.46248 \n",
".. ... \n",
"495 48901.44342 \n",
"496 31491.41457 \n",
"497 64147.28888 \n",
"498 45442.15353 \n",
"499 45107.22566 \n",
"\n",
"[500 rows x 9 columns]"
],
"text/html": [
"\n",
" <div id=\"df-0aa7e9cd-ec66-4528-aadc-5e0c020e5488\">\n",
" <div class=\"colab-df-container\">\n",
" <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>Customer Name</th>\n",
" <th>Customer e-mail</th>\n",
" <th>Country</th>\n",
" <th>Gender</th>\n",
" <th>Age</th>\n",
" <th>Annual Salary</th>\n",
" <th>Credit Card Debt</th>\n",
" <th>Net Worth</th>\n",
" <th>Car Purchase Amount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Martina Avila</td>\n",
" <td>cubilia.Curae.Phasellus@quisaccumsanconvallis.edu</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>42</td>\n",
" <td>62812.09301</td>\n",
" <td>11609.380910</td>\n",
" <td>238961.2505</td>\n",
" <td>35321.45877</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Harlan Barnes</td>\n",
" <td>eu.dolor@diam.co.uk</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>41</td>\n",
" <td>66646.89292</td>\n",
" <td>9572.957136</td>\n",
" <td>530973.9078</td>\n",
" <td>45115.52566</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Naomi Rodriquez</td>\n",
" <td>vulputate.mauris.sagittis@ametconsectetueradip...</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>43</td>\n",
" <td>53798.55112</td>\n",
" <td>11160.355060</td>\n",
" <td>638467.1773</td>\n",
" <td>42925.70921</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Jade Cunningham</td>\n",
" <td>malesuada@dignissim.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>58</td>\n",
" <td>79370.03798</td>\n",
" <td>14426.164850</td>\n",
" <td>548599.0524</td>\n",
" <td>67422.36313</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Cedric Leach</td>\n",
" <td>felis.ullamcorper.viverra@egetmollislectus.net</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>57</td>\n",
" <td>59729.15130</td>\n",
" <td>5358.712177</td>\n",
" <td>560304.0671</td>\n",
" <td>55915.46248</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>495</th>\n",
" <td>Walter</td>\n",
" <td>ligula@Cumsociis.ca</td>\n",
" <td>USA</td>\n",
" <td>0</td>\n",
" <td>41</td>\n",
" <td>71942.40291</td>\n",
" <td>6995.902524</td>\n",
" <td>541670.1016</td>\n",
" <td>48901.44342</td>\n",
" </tr>\n",
" <tr>\n",
" <th>496</th>\n",
" <td>Vanna</td>\n",
" <td>Cum.sociis.natoque@Sedmolestie.edu</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>38</td>\n",
" <td>56039.49793</td>\n",
" <td>12301.456790</td>\n",
" <td>360419.0988</td>\n",
" <td>31491.41457</td>\n",
" </tr>\n",
" <tr>\n",
" <th>497</th>\n",
" <td>Pearl</td>\n",
" <td>penatibus.et@massanonante.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>54</td>\n",
" <td>68888.77805</td>\n",
" <td>10611.606860</td>\n",
" <td>764531.3203</td>\n",
" <td>64147.28888</td>\n",
" </tr>\n",
" <tr>\n",
" <th>498</th>\n",
" <td>Nell</td>\n",
" <td>Quisque.varius@arcuVivamussit.net</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>59</td>\n",
" <td>49811.99062</td>\n",
" <td>14013.034510</td>\n",
" <td>337826.6382</td>\n",
" <td>45442.15353</td>\n",
" </tr>\n",
" <tr>\n",
" <th>499</th>\n",
" <td>Marla</td>\n",
" <td>Camaron.marla@hotmail.com</td>\n",
" <td>USA</td>\n",
" <td>1</td>\n",
" <td>47</td>\n",
" <td>61370.67766</td>\n",
" <td>9391.341628</td>\n",
" <td>462946.4924</td>\n",
" <td>45107.22566</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>500 rows × 9 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\"
onclick=\"convertToInteractive('df-0aa7e9cd-ec66-4528-aadc-5e0c020e5488')\"\n",
" title=\"Convert this dataframe to an interactive
table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\"
height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-
2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-
2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94
2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-
1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59
1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4
18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px
rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-0aa7e9cd-ec66-4528-aadc-
5e0c020e5488 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-0aa7e9cd-ec66-
4528-aadc-5e0c020e5488');\n",
" const dataTable =\n",
" await
google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\"
href=https://colab.research.google.com/notebooks/data_table.ipynb>data table
notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable,
element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 20
}
]
},
{
"cell_type": "code",
"source": [
"data.describe()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 297
},
"id": "OBLPPMF726xm",
"outputId": "42307601-1dd8-484b-fd4a-36e506b9f131"
},
"execution_count": 21,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Gender Age Annual Salary Credit Card Debt \\\
n",
"count 500.000000 500.000000 500.000000 500.000000 \
n",
"mean 0.506000 46.224000 62127.239608 9607.645049 \
n",
"std 0.500465 7.990339 11703.378228 3489.187973 \
n",
"min 0.000000 20.000000 20000.000000 100.000000 \
n",
"25% 0.000000 41.000000 54391.977195 7397.515792 \
n",
"50% 1.000000 46.000000 62915.497035 9655.035568 \
n",
"75% 1.000000 52.000000 70117.862005 11798.867487 \
n",
"max 1.000000 70.000000 100000.000000 20000.000000 \
n",
"\n",
" Net Worth Car Purchase Amount \n",
"count 500.000000 500.000000 \n",
"mean 431475.713625 44209.799218 \n",
"std 173536.756340 10773.178744 \n",
"min 20000.000000 9000.000000 \n",
"25% 299824.195900 37629.896040 \n",
"50% 426750.120650 43997.783390 \n",
"75% 557324.478725 51254.709517 \n",
"max 1000000.000000 80000.000000 "
],
"text/html": [
"\n",
" <div id=\"df-d8398364-1c97-4c17-b779-2b0be56fb629\">\n",
" <div class=\"colab-df-container\">\n",
" <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>Gender</th>\n",
" <th>Age</th>\n",
" <th>Annual Salary</th>\n",
" <th>Credit Card Debt</th>\n",
" <th>Net Worth</th>\n",
" <th>Car Purchase Amount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>500.000000</td>\n",
" <td>500.000000</td>\n",
" <td>500.000000</td>\n",
" <td>500.000000</td>\n",
" <td>500.000000</td>\n",
" <td>500.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>0.506000</td>\n",
" <td>46.224000</td>\n",
" <td>62127.239608</td>\n",
" <td>9607.645049</td>\n",
" <td>431475.713625</td>\n",
" <td>44209.799218</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>0.500465</td>\n",
" <td>7.990339</td>\n",
" <td>11703.378228</td>\n",
" <td>3489.187973</td>\n",
" <td>173536.756340</td>\n",
" <td>10773.178744</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.000000</td>\n",
" <td>20.000000</td>\n",
" <td>20000.000000</td>\n",
" <td>100.000000</td>\n",
" <td>20000.000000</td>\n",
" <td>9000.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>0.000000</td>\n",
" <td>41.000000</td>\n",
" <td>54391.977195</td>\n",
" <td>7397.515792</td>\n",
" <td>299824.195900</td>\n",
" <td>37629.896040</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>1.000000</td>\n",
" <td>46.000000</td>\n",
" <td>62915.497035</td>\n",
" <td>9655.035568</td>\n",
" <td>426750.120650</td>\n",
" <td>43997.783390</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>1.000000</td>\n",
" <td>52.000000</td>\n",
" <td>70117.862005</td>\n",
" <td>11798.867487</td>\n",
" <td>557324.478725</td>\n",
" <td>51254.709517</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>1.000000</td>\n",
" <td>70.000000</td>\n",
" <td>100000.000000</td>\n",
" <td>20000.000000</td>\n",
" <td>1000000.000000</td>\n",
" <td>80000.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\"
onclick=\"convertToInteractive('df-d8398364-1c97-4c17-b779-2b0be56fb629')\"\n",
" title=\"Convert this dataframe to an interactive
table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\"
height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-
2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-
2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94
2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-
1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59
1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4
18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px
rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-d8398364-1c97-4c17-b779-
2b0be56fb629 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-d8398364-1c97-
4c17-b779-2b0be56fb629');\n",
" const dataTable =\n",
" await
google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\"
href=https://colab.research.google.com/notebooks/data_table.ipynb>data table
notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable,
element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 21
}
]
},
{
"cell_type": "markdown",
"source": [
"'.describe' is used in order to see mean, std, min and max"
],
"metadata": {
"id": "snf-QDppGDSM"
}
},
{
"cell_type": "code",
"source": [
"data[['Gender','Annual Salary', 'Credit Card Debt', 'Net Worth']]\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 419
},
"id": "IGAm0ITU5M6C",
"outputId": "fb88ba4c-ddb0-4892-b236-b3dbf50dcb2d"
},
"execution_count": 22,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Gender Annual Salary Credit Card Debt Net Worth\n",
"0 0 62812.09301 11609.380910 238961.2505\n",
"1 0 66646.89292 9572.957136 530973.9078\n",
"2 1 53798.55112 11160.355060 638467.1773\n",
"3 1 79370.03798 14426.164850 548599.0524\n",
"4 1 59729.15130 5358.712177 560304.0671\n",
".. ... ... ... ...\n",
"495 0 71942.40291 6995.902524 541670.1016\n",
"496 1 56039.49793 12301.456790 360419.0988\n",
"497 1 68888.77805 10611.606860 764531.3203\n",
"498 1 49811.99062 14013.034510 337826.6382\n",
"499 1 61370.67766 9391.341628 462946.4924\n",
"\n",
"[500 rows x 4 columns]"
],
"text/html": [
"\n",
" <div id=\"df-e790b754-bcf4-4f71-b262-9a699e596cb2\">\n",
" <div class=\"colab-df-container\">\n",
" <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>Gender</th>\n",
" <th>Annual Salary</th>\n",
" <th>Credit Card Debt</th>\n",
" <th>Net Worth</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>62812.09301</td>\n",
" <td>11609.380910</td>\n",
" <td>238961.2505</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0</td>\n",
" <td>66646.89292</td>\n",
" <td>9572.957136</td>\n",
" <td>530973.9078</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1</td>\n",
" <td>53798.55112</td>\n",
" <td>11160.355060</td>\n",
" <td>638467.1773</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>79370.03798</td>\n",
" <td>14426.164850</td>\n",
" <td>548599.0524</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1</td>\n",
" <td>59729.15130</td>\n",
" <td>5358.712177</td>\n",
" <td>560304.0671</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>495</th>\n",
" <td>0</td>\n",
" <td>71942.40291</td>\n",
" <td>6995.902524</td>\n",
" <td>541670.1016</td>\n",
" </tr>\n",
" <tr>\n",
" <th>496</th>\n",
" <td>1</td>\n",
" <td>56039.49793</td>\n",
" <td>12301.456790</td>\n",
" <td>360419.0988</td>\n",
" </tr>\n",
" <tr>\n",
" <th>497</th>\n",
" <td>1</td>\n",
" <td>68888.77805</td>\n",
" <td>10611.606860</td>\n",
" <td>764531.3203</td>\n",
" </tr>\n",
" <tr>\n",
" <th>498</th>\n",
" <td>1</td>\n",
" <td>49811.99062</td>\n",
" <td>14013.034510</td>\n",
" <td>337826.6382</td>\n",
" </tr>\n",
" <tr>\n",
" <th>499</th>\n",
" <td>1</td>\n",
" <td>61370.67766</td>\n",
" <td>9391.341628</td>\n",
" <td>462946.4924</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>500 rows × 4 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\"
onclick=\"convertToInteractive('df-e790b754-bcf4-4f71-b262-9a699e596cb2')\"\n",
" title=\"Convert this dataframe to an interactive
table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\"
height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-
2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-
2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94
2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-
1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59
1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4
18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px
rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-e790b754-bcf4-4f71-b262-
9a699e596cb2 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-e790b754-bcf4-
4f71-b262-9a699e596cb2');\n",
" const dataTable =\n",
" await
google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\"
href=https://colab.research.google.com/notebooks/data_table.ipynb>data table
notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable,
element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 22
}
]
},
{
"cell_type": "markdown",
"source": [
"chose three different columns "
],
"metadata": {
"id": "3eCoxZ-9GSuQ"
}
},
{
"cell_type": "code",
"source": [
"x = data['Annual Salary'].max()\n",
"y = data['Annual Salary'].min()\n",
"print ('max',x)\n",
"print ('min',y)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ESiZFPIs5hG0",
"outputId": "cc9db722-a4e4-4cde-e3e5-2e71930cca46"
},
"execution_count": 23,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"max 100000.0\n",
"min 20000.0\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"through '.max' and '.min' we printed maximum and minimum annual salaries
from the data"
],
"metadata": {
"id": "Fdq1hszBGcK2"
}
},
{
"cell_type": "code",
"source": [
"dias = data['Net Worth'].sum()\n",
"nurtas = data['Net Worth'].mean()\n",
"dias = dias.astype(int)\n",
"nurtas = nurtas.astype(int)\n",
"print ('Sum',dias)\n",
"print ('Mean',nurtas)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "aS-52iWi_UEK",
"outputId": "365c9fc5-2bfd-4474-91a7-47404770ec72"
},
"execution_count": 26,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Sum 215737856\n",
"Mean 431475\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"selected column 'Net Worth' and found its sum, mean without any decimals"
],
"metadata": {
"id": "uD5bZdmOGp7E"
}
}
]
}

You might also like