ium_444421/preparation.ipynb

2567 lines
655 KiB
Plaintext
Raw Normal View History

2022-03-20 17:35:07 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
2022-03-20 19:23:11 +01:00
"id": "sorted-malawi",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [],
"source": [
"!kaggle datasets download -d tejashvi14/travel-insurance-prediction-data"
]
},
{
"cell_type": "code",
"execution_count": null,
2022-03-20 19:23:11 +01:00
"id": "material-export",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [],
"source": [
"!unzip -o travel-insurance-prediction-data.zip"
]
},
{
"cell_type": "code",
"execution_count": 5,
2022-03-20 19:23:11 +01:00
"id": "excited-midnight",
2022-03-20 17:35:07 +01:00
"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>Age</th>\n",
" <th>Employment Type</th>\n",
" <th>GraduateOrNot</th>\n",
" <th>AnnualIncome</th>\n",
" <th>FamilyMembers</th>\n",
" <th>ChronicDiseases</th>\n",
" <th>FrequentFlyer</th>\n",
" <th>EverTravelledAbroad</th>\n",
" <th>TravelInsurance</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>400000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1250000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>8</td>\n",
" <td>1</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>25</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>1150000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1300000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1450000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>33</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>800000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>400000</td>\n",
" <td>9</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>26</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1400000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>32</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>850000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1500000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>400000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1150000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>800000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>29</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1050000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1500000</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1150000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>29</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>28</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>600000</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1500000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>35</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>800000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>1300000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1250000</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>26</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>600000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>900000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</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>1957</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1250000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1958</th>\n",
" <td>31</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1300000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1959</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>550000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1960</th>\n",
" <td>28</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>300000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1961</th>\n",
" <td>26</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>500000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1962</th>\n",
" <td>25</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>1150000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1963</th>\n",
" <td>33</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1964</th>\n",
" <td>28</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1965</th>\n",
" <td>30</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>550000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1966</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1967</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1968</th>\n",
" <td>28</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>300000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1969</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1970</th>\n",
" <td>29</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1971</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>950000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1972</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>800000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1973</th>\n",
" <td>31</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1974</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1200000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1975</th>\n",
" <td>26</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1400000</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1976</th>\n",
" <td>32</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>900000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1977</th>\n",
" <td>25</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>1350000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1978</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>700000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1979</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1980</th>\n",
" <td>25</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>No</td>\n",
" <td>1150000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1981</th>\n",
" <td>27</td>\n",
" <td>Government Sector</td>\n",
" <td>Yes</td>\n",
" <td>850000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1982</th>\n",
" <td>33</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1983</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1750000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1984</th>\n",
" <td>28</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1150000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1985</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>1000000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1986</th>\n",
" <td>34</td>\n",
" <td>Private Sector/Self Employed</td>\n",
" <td>Yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>No</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1987 rows × 9 columns</p>\n",
"</div>"
],
"text/plain": [
" Age Employment Type GraduateOrNot AnnualIncome \\\n",
"0 31 Government Sector Yes 400000 \n",
"1 31 Private Sector/Self Employed Yes 1250000 \n",
"2 34 Private Sector/Self Employed Yes 500000 \n",
"3 28 Private Sector/Self Employed Yes 700000 \n",
"4 28 Private Sector/Self Employed Yes 700000 \n",
"5 25 Private Sector/Self Employed No 1150000 \n",
"6 31 Government Sector Yes 1300000 \n",
"7 31 Private Sector/Self Employed Yes 1350000 \n",
"8 28 Private Sector/Self Employed Yes 1450000 \n",
"9 33 Government Sector Yes 800000 \n",
"10 31 Government Sector Yes 400000 \n",
"11 26 Private Sector/Self Employed Yes 1400000 \n",
"12 32 Government Sector Yes 850000 \n",
"13 31 Government Sector Yes 1500000 \n",
"14 31 Government Sector Yes 400000 \n",
"15 34 Private Sector/Self Employed Yes 700000 \n",
"16 28 Private Sector/Self Employed Yes 1150000 \n",
"17 28 Private Sector/Self Employed Yes 800000 \n",
"18 29 Private Sector/Self Employed Yes 1050000 \n",
"19 34 Private Sector/Self Employed Yes 1500000 \n",
"20 28 Private Sector/Self Employed Yes 1150000 \n",
"21 29 Private Sector/Self Employed Yes 350000 \n",
"22 31 Private Sector/Self Employed Yes 1100000 \n",
"23 28 Government Sector Yes 600000 \n",
"24 31 Government Sector Yes 1500000 \n",
"25 35 Private Sector/Self Employed No 800000 \n",
"26 34 Private Sector/Self Employed No 1300000 \n",
"27 28 Private Sector/Self Employed Yes 1250000 \n",
"28 26 Private Sector/Self Employed Yes 600000 \n",
"29 31 Private Sector/Self Employed Yes 900000 \n",
"... ... ... ... ... \n",
"1957 31 Private Sector/Self Employed Yes 1250000 \n",
"1958 31 Government Sector Yes 1300000 \n",
"1959 28 Private Sector/Self Employed No 550000 \n",
"1960 28 Government Sector Yes 300000 \n",
"1961 26 Government Sector Yes 500000 \n",
"1962 25 Private Sector/Self Employed No 1150000 \n",
"1963 33 Government Sector Yes 1100000 \n",
"1964 28 Government Sector Yes 1100000 \n",
"1965 30 Private Sector/Self Employed No 550000 \n",
"1966 34 Private Sector/Self Employed Yes 700000 \n",
"1967 34 Private Sector/Self Employed Yes 700000 \n",
"1968 28 Government Sector Yes 300000 \n",
"1969 31 Private Sector/Self Employed Yes 500000 \n",
"1970 29 Private Sector/Self Employed Yes 500000 \n",
"1971 31 Private Sector/Self Employed Yes 950000 \n",
"1972 28 Private Sector/Self Employed Yes 800000 \n",
"1973 31 Private Sector/Self Employed Yes 1350000 \n",
"1974 28 Private Sector/Self Employed Yes 1200000 \n",
"1975 26 Private Sector/Self Employed Yes 1400000 \n",
"1976 32 Government Sector Yes 900000 \n",
"1977 25 Private Sector/Self Employed No 1350000 \n",
"1978 34 Private Sector/Self Employed Yes 700000 \n",
"1979 28 Private Sector/Self Employed Yes 1100000 \n",
"1980 25 Private Sector/Self Employed No 1150000 \n",
"1981 27 Government Sector Yes 850000 \n",
"1982 33 Private Sector/Self Employed Yes 1500000 \n",
"1983 28 Private Sector/Self Employed Yes 1750000 \n",
"1984 28 Private Sector/Self Employed Yes 1150000 \n",
"1985 34 Private Sector/Self Employed Yes 1000000 \n",
"1986 34 Private Sector/Self Employed Yes 500000 \n",
"\n",
" FamilyMembers ChronicDiseases FrequentFlyer EverTravelledAbroad \\\n",
"0 6 1 No No \n",
"1 7 0 No No \n",
"2 4 1 No No \n",
"3 3 1 No No \n",
"4 8 1 Yes No \n",
"5 4 0 No No \n",
"6 4 0 No No \n",
"7 3 0 Yes Yes \n",
"8 6 1 Yes Yes \n",
"9 3 0 Yes No \n",
"10 9 1 No No \n",
"11 5 0 Yes Yes \n",
"12 6 0 No No \n",
"13 6 0 Yes Yes \n",
"14 3 0 No No \n",
"15 7 0 No No \n",
"16 4 1 No No \n",
"17 7 0 No No \n",
"18 5 1 No No \n",
"19 2 0 Yes Yes \n",
"20 6 0 Yes No \n",
"21 3 0 No No \n",
"22 4 0 No No \n",
"23 9 0 No No \n",
"24 7 0 Yes Yes \n",
"25 4 0 No Yes \n",
"26 6 0 Yes No \n",
"27 2 0 Yes No \n",
"28 4 0 Yes No \n",
"29 3 0 No No \n",
"... ... ... ... ... \n",
"1957 7 0 No No \n",
"1958 3 1 No No \n",
"1959 6 0 No No \n",
"1960 6 0 No No \n",
"1961 3 0 No No \n",
"1962 7 0 No No \n",
"1963 4 0 No No \n",
"1964 4 0 No No \n",
"1965 3 0 No No \n",
"1966 3 0 Yes No \n",
"1967 3 1 No No \n",
"1968 5 1 No No \n",
"1969 4 1 No No \n",
"1970 4 0 No No \n",
"1971 5 0 No No \n",
"1972 5 1 No No \n",
"1973 3 0 No Yes \n",
"1974 6 0 Yes No \n",
"1975 9 0 No Yes \n",
"1976 6 0 No No \n",
"1977 6 0 No Yes \n",
"1978 5 0 No No \n",
"1979 4 1 No No \n",
"1980 5 1 No No \n",
"1981 3 0 No No \n",
"1982 4 0 Yes Yes \n",
"1983 5 1 No Yes \n",
"1984 6 1 No No \n",
"1985 6 0 Yes Yes \n",
"1986 4 0 No No \n",
"\n",
" TravelInsurance \n",
"0 0 \n",
"1 0 \n",
"2 1 \n",
"3 0 \n",
"4 0 \n",
"5 0 \n",
"6 0 \n",
"7 1 \n",
"8 1 \n",
"9 0 \n",
"10 0 \n",
"11 1 \n",
"12 1 \n",
"13 1 \n",
"14 0 \n",
"15 0 \n",
"16 0 \n",
"17 1 \n",
"18 1 \n",
"19 1 \n",
"20 0 \n",
"21 1 \n",
"22 0 \n",
"23 1 \n",
"24 0 \n",
"25 0 \n",
"26 1 \n",
"27 0 \n",
"28 0 \n",
"29 0 \n",
"... ... \n",
"1957 0 \n",
"1958 0 \n",
"1959 0 \n",
"1960 1 \n",
"1961 0 \n",
"1962 0 \n",
"1963 1 \n",
"1964 0 \n",
"1965 1 \n",
"1966 0 \n",
"1967 0 \n",
"1968 0 \n",
"1969 0 \n",
"1970 1 \n",
"1971 0 \n",
"1972 0 \n",
"1973 1 \n",
"1974 0 \n",
"1975 1 \n",
"1976 0 \n",
"1977 1 \n",
"1978 1 \n",
"1979 0 \n",
"1980 0 \n",
"1981 1 \n",
"1982 1 \n",
"1983 0 \n",
"1984 0 \n",
"1985 1 \n",
"1986 0 \n",
"\n",
"[1987 rows x 9 columns]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"travel_insurance=pd.read_csv('TravelInsurancePrediction.csv', index_col=0)\n",
"travel_insurance"
]
},
{
"cell_type": "code",
"execution_count": null,
2022-03-20 19:23:11 +01:00
"id": "coordinate-count",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [],
"source": [
"# usunięcie wierszy zawierających braki\n",
"travel_insurance.dropna(axis='index', how='any')"
]
},
{
"cell_type": "code",
"execution_count": 6,
2022-03-20 19:23:11 +01:00
"id": "stock-fabric",
2022-03-20 17:35:07 +01:00
"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>Age</th>\n",
" <th>Employment Type</th>\n",
" <th>GraduateOrNot</th>\n",
" <th>AnnualIncome</th>\n",
" <th>FamilyMembers</th>\n",
" <th>ChronicDiseases</th>\n",
" <th>FrequentFlyer</th>\n",
" <th>EverTravelledAbroad</th>\n",
" <th>TravelInsurance</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>400000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1250000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>8</td>\n",
" <td>1</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>25</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>1150000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1300000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1450000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>33</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>800000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>400000</td>\n",
" <td>9</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>26</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1400000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>32</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>850000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1500000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>400000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1150000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>800000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>29</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1050000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1500000</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1150000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>29</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>28</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>600000</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1500000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>35</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>800000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>1300000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1250000</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>26</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>600000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>900000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</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>1957</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1250000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1958</th>\n",
" <td>31</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1300000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1959</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>550000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1960</th>\n",
" <td>28</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>300000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1961</th>\n",
" <td>26</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>500000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1962</th>\n",
" <td>25</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>1150000</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1963</th>\n",
" <td>33</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1964</th>\n",
" <td>28</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1965</th>\n",
" <td>30</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>550000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1966</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1967</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1968</th>\n",
" <td>28</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>300000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1969</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1970</th>\n",
" <td>29</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1971</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>950000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1972</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>800000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1973</th>\n",
" <td>31</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1350000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1974</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1200000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1975</th>\n",
" <td>26</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1400000</td>\n",
" <td>9</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1976</th>\n",
" <td>32</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>900000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1977</th>\n",
" <td>25</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>1350000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1978</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>700000</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1979</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1100000</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1980</th>\n",
" <td>25</td>\n",
" <td>private sector/self employed</td>\n",
" <td>no</td>\n",
" <td>1150000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1981</th>\n",
" <td>27</td>\n",
" <td>government sector</td>\n",
" <td>yes</td>\n",
" <td>850000</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1982</th>\n",
" <td>33</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1983</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1750000</td>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1984</th>\n",
" <td>28</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1150000</td>\n",
" <td>6</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1985</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>1000000</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1986</th>\n",
" <td>34</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>500000</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1987 rows × 9 columns</p>\n",
"</div>"
],
"text/plain": [
" Age Employment Type GraduateOrNot AnnualIncome \\\n",
"0 31 government sector yes 400000 \n",
"1 31 private sector/self employed yes 1250000 \n",
"2 34 private sector/self employed yes 500000 \n",
"3 28 private sector/self employed yes 700000 \n",
"4 28 private sector/self employed yes 700000 \n",
"5 25 private sector/self employed no 1150000 \n",
"6 31 government sector yes 1300000 \n",
"7 31 private sector/self employed yes 1350000 \n",
"8 28 private sector/self employed yes 1450000 \n",
"9 33 government sector yes 800000 \n",
"10 31 government sector yes 400000 \n",
"11 26 private sector/self employed yes 1400000 \n",
"12 32 government sector yes 850000 \n",
"13 31 government sector yes 1500000 \n",
"14 31 government sector yes 400000 \n",
"15 34 private sector/self employed yes 700000 \n",
"16 28 private sector/self employed yes 1150000 \n",
"17 28 private sector/self employed yes 800000 \n",
"18 29 private sector/self employed yes 1050000 \n",
"19 34 private sector/self employed yes 1500000 \n",
"20 28 private sector/self employed yes 1150000 \n",
"21 29 private sector/self employed yes 350000 \n",
"22 31 private sector/self employed yes 1100000 \n",
"23 28 government sector yes 600000 \n",
"24 31 government sector yes 1500000 \n",
"25 35 private sector/self employed no 800000 \n",
"26 34 private sector/self employed no 1300000 \n",
"27 28 private sector/self employed yes 1250000 \n",
"28 26 private sector/self employed yes 600000 \n",
"29 31 private sector/self employed yes 900000 \n",
"... ... ... ... ... \n",
"1957 31 private sector/self employed yes 1250000 \n",
"1958 31 government sector yes 1300000 \n",
"1959 28 private sector/self employed no 550000 \n",
"1960 28 government sector yes 300000 \n",
"1961 26 government sector yes 500000 \n",
"1962 25 private sector/self employed no 1150000 \n",
"1963 33 government sector yes 1100000 \n",
"1964 28 government sector yes 1100000 \n",
"1965 30 private sector/self employed no 550000 \n",
"1966 34 private sector/self employed yes 700000 \n",
"1967 34 private sector/self employed yes 700000 \n",
"1968 28 government sector yes 300000 \n",
"1969 31 private sector/self employed yes 500000 \n",
"1970 29 private sector/self employed yes 500000 \n",
"1971 31 private sector/self employed yes 950000 \n",
"1972 28 private sector/self employed yes 800000 \n",
"1973 31 private sector/self employed yes 1350000 \n",
"1974 28 private sector/self employed yes 1200000 \n",
"1975 26 private sector/self employed yes 1400000 \n",
"1976 32 government sector yes 900000 \n",
"1977 25 private sector/self employed no 1350000 \n",
"1978 34 private sector/self employed yes 700000 \n",
"1979 28 private sector/self employed yes 1100000 \n",
"1980 25 private sector/self employed no 1150000 \n",
"1981 27 government sector yes 850000 \n",
"1982 33 private sector/self employed yes 1500000 \n",
"1983 28 private sector/self employed yes 1750000 \n",
"1984 28 private sector/self employed yes 1150000 \n",
"1985 34 private sector/self employed yes 1000000 \n",
"1986 34 private sector/self employed yes 500000 \n",
"\n",
" FamilyMembers ChronicDiseases FrequentFlyer EverTravelledAbroad \\\n",
"0 6 1 no no \n",
"1 7 0 no no \n",
"2 4 1 no no \n",
"3 3 1 no no \n",
"4 8 1 yes no \n",
"5 4 0 no no \n",
"6 4 0 no no \n",
"7 3 0 yes yes \n",
"8 6 1 yes yes \n",
"9 3 0 yes no \n",
"10 9 1 no no \n",
"11 5 0 yes yes \n",
"12 6 0 no no \n",
"13 6 0 yes yes \n",
"14 3 0 no no \n",
"15 7 0 no no \n",
"16 4 1 no no \n",
"17 7 0 no no \n",
"18 5 1 no no \n",
"19 2 0 yes yes \n",
"20 6 0 yes no \n",
"21 3 0 no no \n",
"22 4 0 no no \n",
"23 9 0 no no \n",
"24 7 0 yes yes \n",
"25 4 0 no yes \n",
"26 6 0 yes no \n",
"27 2 0 yes no \n",
"28 4 0 yes no \n",
"29 3 0 no no \n",
"... ... ... ... ... \n",
"1957 7 0 no no \n",
"1958 3 1 no no \n",
"1959 6 0 no no \n",
"1960 6 0 no no \n",
"1961 3 0 no no \n",
"1962 7 0 no no \n",
"1963 4 0 no no \n",
"1964 4 0 no no \n",
"1965 3 0 no no \n",
"1966 3 0 yes no \n",
"1967 3 1 no no \n",
"1968 5 1 no no \n",
"1969 4 1 no no \n",
"1970 4 0 no no \n",
"1971 5 0 no no \n",
"1972 5 1 no no \n",
"1973 3 0 no yes \n",
"1974 6 0 yes no \n",
"1975 9 0 no yes \n",
"1976 6 0 no no \n",
"1977 6 0 no yes \n",
"1978 5 0 no no \n",
"1979 4 1 no no \n",
"1980 5 1 no no \n",
"1981 3 0 no no \n",
"1982 4 0 yes yes \n",
"1983 5 1 no yes \n",
"1984 6 1 no no \n",
"1985 6 0 yes yes \n",
"1986 4 0 no no \n",
"\n",
" TravelInsurance \n",
"0 0 \n",
"1 0 \n",
"2 1 \n",
"3 0 \n",
"4 0 \n",
"5 0 \n",
"6 0 \n",
"7 1 \n",
"8 1 \n",
"9 0 \n",
"10 0 \n",
"11 1 \n",
"12 1 \n",
"13 1 \n",
"14 0 \n",
"15 0 \n",
"16 0 \n",
"17 1 \n",
"18 1 \n",
"19 1 \n",
"20 0 \n",
"21 1 \n",
"22 0 \n",
"23 1 \n",
"24 0 \n",
"25 0 \n",
"26 1 \n",
"27 0 \n",
"28 0 \n",
"29 0 \n",
"... ... \n",
"1957 0 \n",
"1958 0 \n",
"1959 0 \n",
"1960 1 \n",
"1961 0 \n",
"1962 0 \n",
"1963 1 \n",
"1964 0 \n",
"1965 1 \n",
"1966 0 \n",
"1967 0 \n",
"1968 0 \n",
"1969 0 \n",
"1970 1 \n",
"1971 0 \n",
"1972 0 \n",
"1973 1 \n",
"1974 0 \n",
"1975 1 \n",
"1976 0 \n",
"1977 1 \n",
"1978 1 \n",
"1979 0 \n",
"1980 0 \n",
"1981 1 \n",
"1982 1 \n",
"1983 0 \n",
"1984 0 \n",
"1985 1 \n",
"1986 0 \n",
"\n",
"[1987 rows x 9 columns]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# normalizacja danych\n",
"for column in travel_insurance.columns:\n",
" if travel_insurance[column].dtype == 'object':\n",
" travel_insurance[column] = travel_insurance[column].str.lower()\n",
"\n",
"travel_insurance"
]
},
{
"cell_type": "code",
"execution_count": 8,
2022-03-20 19:23:11 +01:00
"id": "authentic-christmas",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [],
"source": [
2022-03-20 19:23:11 +01:00
"# podział na podzbiory train/dev/test\n",
2022-03-20 17:35:07 +01:00
"import sklearn\n",
"from sklearn.model_selection import train_test_split\n",
"travel_insurance_train, travel_insurance_rest = sklearn.model_selection.train_test_split(travel_insurance, test_size=0.4, random_state=1)\n",
"travel_insurance_test, travel_insurance_dev = sklearn.model_selection.train_test_split(travel_insurance_rest, test_size=0.5, random_state=1)"
]
},
2022-03-20 19:23:11 +01:00
{
"cell_type": "code",
"execution_count": 27,
"id": "coordinate-swimming",
"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>Age</th>\n",
" <th>Employment Type</th>\n",
" <th>GraduateOrNot</th>\n",
" <th>AnnualIncome</th>\n",
" <th>FamilyMembers</th>\n",
" <th>ChronicDiseases</th>\n",
" <th>FrequentFlyer</th>\n",
" <th>EverTravelledAbroad</th>\n",
" <th>TravelInsurance</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>1987.0</td>\n",
" <td>1987</td>\n",
" <td>1988</td>\n",
" <td>1.987000e+03</td>\n",
" <td>1988.000000</td>\n",
" <td>1988.000000</td>\n",
" <td>1988</td>\n",
" <td>1988</td>\n",
" <td>1988.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>unique</th>\n",
" <td>11.0</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>top</th>\n",
" <td>28.0</td>\n",
" <td>private sector/self employed</td>\n",
" <td>yes</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>no</td>\n",
" <td>no</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>freq</th>\n",
" <td>506.0</td>\n",
" <td>1417</td>\n",
" <td>1693</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1571</td>\n",
" <td>1608</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>9.327630e+05</td>\n",
" <td>4.753018</td>\n",
" <td>0.277666</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.357646</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>3.768557e+05</td>\n",
" <td>1.609254</td>\n",
" <td>0.447960</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.479428</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>3.000000e+05</td>\n",
" <td>2.000000</td>\n",
" <td>0.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>6.000000e+05</td>\n",
" <td>4.000000</td>\n",
" <td>0.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>9.000000e+05</td>\n",
" <td>5.000000</td>\n",
" <td>0.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1.250000e+06</td>\n",
" <td>6.000000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1.800000e+06</td>\n",
" <td>9.000000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Age Employment Type GraduateOrNot AnnualIncome \\\n",
"count 1987.0 1987 1988 1.987000e+03 \n",
"unique 11.0 2 2 NaN \n",
"top 28.0 private sector/self employed yes NaN \n",
"freq 506.0 1417 1693 NaN \n",
"mean NaN NaN NaN 9.327630e+05 \n",
"std NaN NaN NaN 3.768557e+05 \n",
"min NaN NaN NaN 3.000000e+05 \n",
"25% NaN NaN NaN 6.000000e+05 \n",
"50% NaN NaN NaN 9.000000e+05 \n",
"75% NaN NaN NaN 1.250000e+06 \n",
"max NaN NaN NaN 1.800000e+06 \n",
"\n",
" FamilyMembers ChronicDiseases FrequentFlyer EverTravelledAbroad \\\n",
"count 1988.000000 1988.000000 1988 1988 \n",
"unique NaN NaN 2 2 \n",
"top NaN NaN no no \n",
"freq NaN NaN 1571 1608 \n",
"mean 4.753018 0.277666 NaN NaN \n",
"std 1.609254 0.447960 NaN NaN \n",
"min 2.000000 0.000000 NaN NaN \n",
"25% 4.000000 0.000000 NaN NaN \n",
"50% 5.000000 0.000000 NaN NaN \n",
"75% 6.000000 1.000000 NaN NaN \n",
"max 9.000000 1.000000 NaN NaN \n",
"\n",
" TravelInsurance \n",
"count 1988.000000 \n",
"unique NaN \n",
"top NaN \n",
"freq NaN \n",
"mean 0.357646 \n",
"std 0.479428 \n",
"min 0.000000 \n",
"25% 0.000000 \n",
"50% 0.000000 \n",
"75% 1.000000 \n",
"max 1.000000 "
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"travel_insurance.describe(include='all')"
]
},
2022-03-20 17:35:07 +01:00
{
"cell_type": "code",
"execution_count": 23,
2022-03-20 19:23:11 +01:00
"id": "enhanced-logic",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [],
"source": [
2022-03-20 19:23:11 +01:00
"# zwracanie informacji o danym zbiorze \n",
"\n",
2022-03-20 17:35:07 +01:00
"import seaborn as sns\n",
"\n",
"def printInformation(data):\n",
" print(f'Size (rows): {len(data)}\\n')\n",
" mean_value = data.mean()\n",
" min_value = data.min(numeric_only=True)\n",
" max_value = data.max(numeric_only=True)\n",
" std_value = data.std()\n",
" median_value = data.median()\n",
" print(f'(mean)\\n{mean_value}', f'(min)\\n{min_value}', f'(max)\\n{max_value}', f'(std)\\n{std_value}', f'(median)\\n{median_value}', sep=\"\\n\\n\")\n",
" sns.pairplot(data=data, hue=\"TravelInsurance\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
2022-03-20 19:23:11 +01:00
"id": "introductory-zimbabwe",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Size (rows): 1988\n",
"\n",
"(mean)\n",
"Age 29.650226\n",
"AnnualIncome 932762.959235\n",
"FamilyMembers 4.753018\n",
"ChronicDiseases 0.277666\n",
"TravelInsurance 0.357646\n",
"dtype: float64\n",
"\n",
"(min)\n",
"AnnualIncome 300000.0\n",
"FamilyMembers 2.0\n",
"ChronicDiseases 0.0\n",
"TravelInsurance 0.0\n",
"dtype: float64\n",
"\n",
"(max)\n",
"AnnualIncome 1800000.0\n",
"FamilyMembers 9.0\n",
"ChronicDiseases 1.0\n",
"TravelInsurance 1.0\n",
"dtype: float64\n",
"\n",
"(std)\n",
"Age 2.913308\n",
"AnnualIncome 376855.684748\n",
"FamilyMembers 1.609254\n",
"ChronicDiseases 0.447960\n",
"TravelInsurance 0.479428\n",
"dtype: float64\n",
"\n",
"(median)\n",
"Age 29.0\n",
"AnnualIncome 900000.0\n",
"FamilyMembers 5.0\n",
"ChronicDiseases 0.0\n",
"TravelInsurance 0.0\n",
"dtype: float64\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnIAAAIVCAYAAABV3xJ3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzsnXd8W9XZ+L9Hw7IkW7Yl7xXPxNkJCQl7jwAtYYRdSKEtpS2l/XXT8UKhA962bwulpQvKatmbQiFsCARIIHs4tuOVeMt7yJJ1fn9c2dKV5NgJdmyR8/189LHvo+fce2QdS889zxJSShQKhUKhUCgUsYdhqiegUCg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B+bOQc6OWXRqgpGc9dyb9h91nnMKgNFI0sJ6s1moo/LJubsa693SFfkXNWuIvewztfi3IabMz+M8Nx7G3o5+0BAsl6QmjZt4qpidZniqu2fdbjg+snVxDE4W7n4HcH+vWTiwyy/0G/y4tp2LRIgxCUtrxAs7OTsj5/FRPTXEYM5nlRx4GTgJShRD1wE1SynuAS4lMcjgBuEUI4QOGgOuklMPBPV8jWH7kpcADNAPuMSHEl4Ba4KKA/EW00iMVaOVHrgYIGIW3Ah8F9G4Juca0QUrJXW9UYDIYuO7EIsQoldA31XeQbDeTlmihLDORl7ZGxm7sj4qWHmZl6Hdr0hMtKt4jVulrhw3/1MukhIo1MDNoyBna6xE7wwr99rUh2nZDftCQo7WC+KqXmV/1sl538eX6L+M975Cy7QGWBZPTkRlzGSo6FaOrUBO490TOzT8E9R9C6Wk6sdEgKM1IpDQ
"text/plain": [
"<Figure size 628.234x540 with 12 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"printInformation(travel_insurance)"
]
},
{
"cell_type": "code",
"execution_count": 11,
2022-03-20 19:23:11 +01:00
"id": "working-championship",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Size (rows): 1192\n",
"\n",
"(mean)\n",
"Age 29.744128\n",
"AnnualIncome 933095.637584\n",
"FamilyMembers 4.814597\n",
"ChronicDiseases 0.269295\n",
"TravelInsurance 0.349832\n",
"dtype: float64\n",
"\n",
"(min)\n",
"Age 25\n",
"AnnualIncome 300000\n",
"FamilyMembers 2\n",
"ChronicDiseases 0\n",
"TravelInsurance 0\n",
"dtype: int64\n",
"\n",
"(max)\n",
"Age 35\n",
"AnnualIncome 1800000\n",
"FamilyMembers 9\n",
"ChronicDiseases 1\n",
"TravelInsurance 1\n",
"dtype: int64\n",
"\n",
"(std)\n",
"Age 2.923164\n",
"AnnualIncome 376856.587539\n",
"FamilyMembers 1.619576\n",
"ChronicDiseases 0.443780\n",
"TravelInsurance 0.477117\n",
"dtype: float64\n",
"\n",
"(median)\n",
"Age 29.0\n",
"AnnualIncome 900000.0\n",
"FamilyMembers 5.0\n",
"ChronicDiseases 0.0\n",
"TravelInsurance 0.0\n",
"dtype: float64\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAyQAAALFCAYAAAAyZSeXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzs3Xd4XGeZ8P/vmappKqPeZVnuPVaa0+sGQodAlhBC2U1eyr6U3R8bdlmyLOy78ANedmEXFgIsAQJJCCkmCeB0x4ljW3GXbVlW7xpNb5p63j8kz2g8siwnVhn7/lyXr8vn0XPOeUa658y55zxFUVUVIYQQQgghhFgImoVugBBCCCGEEOLCJQmJEEIIIYQQYsFIQiKEEEIIIYRYMJKQCCGEEEIIIRaMJCRCCCGEEEKIBSMJiRBCCCGEEGLBSEIihBBCCCGEWDCSkAghhBBCCCEWjCQkQgghhBBCiAUjCckZ3HLLLSog/xbnvwuCxOCi/ndBkBhc1P8uCBKDi/qfEG+ZJCRnMDY2ttBNEBc4iUGx0CQGxUKTGBTi/CYJiRBCCCGEEGLBSEIihBBCCCGEWDCSkAghhBBCCCEWjCQkQgghhBBCiAWjW+gGiLcmEIlj0mvRapSFboo4zwSjcTpGAwQjCRqKzVQWmrLqHO530+UMYTXqaCzSU6ILoR87ihIfJ1CwjD0uM/VFeayoLUvtE+o7iM7TiWoqIly0ksLi8vl8WWKBdDr8tI8G0KCwvNxKfYk1q86Y00nvmI9AJEZtkYUltdVZdULhMEeHfAx5x6koyGN5aT75tuli00W3MzwRm8VG6koLs+qER9rRuTsgGSdRtJS8ylXZDfeNgqMVQk4orIPaS6Z/gc4O8PaDpQSKl4NOn1XF4XTSOeL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fyuel2eDDotCypsGOxZD81eRMkBt+iUChE22iQYV+UMpuB1RVWTNPEVK4YGRlmwBMmnkhSU2yhqrxirk95QcSgmFsyy1aO6nOFKLfloSgK5fl59HvCqKqKosh1QZwbeXotqypnnmVmVVURq6pOKSycGENiB27InrUVS80aYOKpSHaKI85X9cUW6ostM9YpLCyksDB7et6pjGYzGxuyk5lTraqxs+oMvQFNJQ1Q0jBzJXMBNF59xvNRWDfxbwZ2exF2e04n4Ocls9nMplnEVK4oL6+gXGZTFzlGumzlqH53mFLbRB/XPL0Ws16LQ2baEkIIIYQQOUYSkhzV7w5RbE0PAi3LNzIwzcxIQgghhBBCLGaSkOSoIc94asYjgGKrkQGPJCRCCCGEECK3SEKSo4a8YexTEpJCk57hU+bZF0IIIYQQYrGThCRHDfvGsVumJCRmQ9bCX0IIIYQQQix2MstWjhrxRSia8oTEbjHQNSar/oo3r2PEy6A3gk6rob4kj6qC7ClJe/t6cQUiFFmM5OUX4QgmWV1pY9ATptsZQlEUlpVZsJuNHBnyodcqLE8cRwk5wVZBLBRCZ7aghJyoejNKxQY0xszpNSORCOPDxyDiB1slBZVLCYz1k/AOoDEXY6tsIuFoR/H2gVZHsmgpusJppvOa1O0M0u8KUWg2sLrShkYj38MshOExNyNuP4oC5fYCyu3Z0/B6AwG6HAGCkQS1hUbqKkqmORIE+w+jDY6QMJdhqV03bZ32EQ8DnigmvYbGchOlluwZvuKefjSuTkgmUIvq0RY3ZtVJjo/TMzyEbzxGRb6R8qr607zAw+AdALMdai+etkrYNUjU1YOiNWAqa0Jvyf4diIXh7D+OGnCgsRRjr1250M15S2KuPrSerom4LqhHW5od10IsNudtQqIoSh6wHTAy8TofVVX1vik//wHwcVVVz8lE8PPNGYxQYE4v3FRk1rN
"text/plain": [
"<Figure size 808.234x720 with 20 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"printInformation(travel_insurance_train)"
]
},
{
"cell_type": "code",
"execution_count": 12,
2022-03-20 19:23:11 +01:00
"id": "ancient-junction",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Size (rows): 397\n",
"\n",
"(mean)\n",
"Age 29.561713\n",
"AnnualIncome 916120.906801\n",
"FamilyMembers 4.622166\n",
"ChronicDiseases 0.287154\n",
"TravelInsurance 0.362720\n",
"dtype: float64\n",
"\n",
"(min)\n",
"Age 25\n",
"AnnualIncome 300000\n",
"FamilyMembers 2\n",
"ChronicDiseases 0\n",
"TravelInsurance 0\n",
"dtype: int64\n",
"\n",
"(max)\n",
"Age 35\n",
"AnnualIncome 1750000\n",
"FamilyMembers 9\n",
"ChronicDiseases 1\n",
"TravelInsurance 1\n",
"dtype: int64\n",
"\n",
"(std)\n",
"Age 2.850544\n",
"AnnualIncome 379748.807848\n",
"FamilyMembers 1.627824\n",
"ChronicDiseases 0.453005\n",
"TravelInsurance 0.481392\n",
"dtype: float64\n",
"\n",
"(median)\n",
"Age 29.0\n",
"AnnualIncome 850000.0\n",
"FamilyMembers 4.0\n",
"ChronicDiseases 0.0\n",
"TravelInsurance 0.0\n",
"dtype: float64\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAyQAAALFCAYAAAAyZSeXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzs3Xd4ZOV5+P3vmaqpaqPet/eGYHfpBmMTwAXcYjDGxgZ+jlsSpziOS+w4cX+T2LEdcFyAYLBNB1NNMXWLtvem3qdoNKPp5bx/zEqj2ZFWEmh3Rtr7c126rj2PnnPmmZ17js59zlMUVVURQgghhBBCiFzQ5LoBQgghhBBCiHOXJCRCCCGEEEKInJGERAghhBBCCJEzkpAIIYQQQgghckYSEiGEEEIIIUTOSEIihBBCCCGE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fu2EVlyzN/wt7p8vNn485+cbT7QSiCepLCvjP66NsWFyX66YJkWU+d9mKAFeoqroWWAdcrSjKJgBFUZqBolw27u3q9YYotWbPqV9kNtDnDeegRWLeaXsFdvwqlYwAHH4CDjwy9use5zBffPgYvnAcgH5fmC8+dIzW7j6++eQR2t2pCRZCsQTffPIQHUNhXj7s5MUjTiB12Ed399LjDWErSD09eeOEm/u2dJJMpl6zo7+Pv3rwGJ5AFAB3IMpfPXiMjkUfSzXiUy/CzrtTyQhAMg5bfw6Dh87of414+7Z3+rlvWxeJk5/1llYPD+7qI5lIj4Hb3eXl4Z09YyH40hEnLx12ZhzntdbhsWQE4Kn9/bzR5suo8+whF88d9QKpuLtvp4tdvYG
"text/plain": [
"<Figure size 808.234x720 with 20 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"printInformation(travel_insurance_test)"
]
},
{
"cell_type": "code",
"execution_count": 13,
2022-03-20 19:23:11 +01:00
"id": "cordless-hawaiian",
2022-03-20 17:35:07 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Size (rows): 398\n",
"\n",
"(mean)\n",
"Age 29.457286\n",
"AnnualIncome 948366.834171\n",
"FamilyMembers 4.698492\n",
"ChronicDiseases 0.293970\n",
"TravelInsurance 0.374372\n",
"dtype: float64\n",
"\n",
"(min)\n",
"Age 25\n",
"AnnualIncome 300000\n",
"FamilyMembers 2\n",
"ChronicDiseases 0\n",
"TravelInsurance 0\n",
"dtype: int64\n",
"\n",
"(max)\n",
"Age 35\n",
"AnnualIncome 1800000\n",
"FamilyMembers 9\n",
"ChronicDiseases 1\n",
"TravelInsurance 1\n",
"dtype: int64\n",
"\n",
"(std)\n",
"Age 2.940542\n",
"AnnualIncome 374204.238614\n",
"FamilyMembers 1.554889\n",
"ChronicDiseases 0.456152\n",
"TravelInsurance 0.484569\n",
"dtype: float64\n",
"\n",
"(median)\n",
"Age 28.0\n",
"AnnualIncome 1000000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2YxMSRVFMwJuAkej7fFJV1W+Pef4nwCdUVbWkqYrnZdATwGTQYNAl3uQqyDbQKwmJOA/9A31k7XmIwu3/DeEgwbLVDN30Y/Kqo4vGRSIRnj/QyzeePsiwJ0iRxcj3bl3KdYtL2dfUyT/+qYFWh48sg5Zv3+jkXZE3aZj1fv7zL0f5ZF0BP9wywAsNwygKfGRFIX+3wc2squqEOtgHennhiIPvvtyOLxhhTqGZ/32fmyV/ei94HVAwB274D3j28zDaE12N+KbvwZx3gFWmvZ4Oevv7+dGrLTy+z46qwjsX5fG1G+dQWRpfcO54Wyc/29zBpoODANy8NJ/7Lp/F3OrKWEywfRfmt/4T5dgLoChol74f/9r7MM5aGYvZ3WrnR680sbnRjkaBW1dVcOf6SpbNGnNy1rETXvkXaH0rmhysvDO6EGLxwnhM+zZ4+VvQsR00Oqi7G1beAWVjFlQcaICn74POHdFE5Iovw9p7wDxmxez+o7DpM9CzB7QGuPrrUPdJMNkm7fcrJoe7+yjmQ39As+1nEA6ilq8keOMP0FdPjynLXz7cy9c2HWRg1E9ulp5/ec9irltoxZIq2RYijWZyly0/cI2qqpcAK4CbFEVZD6AoSh2Qe7qdM13viI+C7OSFvfKyDXTLOBJxHvS9e7Fs+T6Eg9Htnl2Ytv8Etzs6YcKBrhG++OQ+hj3R5wdcfr745H4OdQ3xtWeO0+rwAeAJhPnKM810197Cpj09DHkCNNk9vNAwDICqwu/32NnZkTxVdbPdwzeeb8UXjHY/bLJ7+faLnYzOuioaMOcaeOZz0WQEwDcMz/wj2A9N1a9FTLLNjXb+uDeajAA8f2SIFw/1JcRsaRmKJSMAfz44yNaW4YQYXfPL0WQEQFVRDjyJoXNbQsxLRwbY3GgHIKLCk7u62Nc1pt2Fw3Dg8WgyAhAJw66HoGv
"text/plain": [
"<Figure size 808.234x720 with 20 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"printInformation(travel_insurance_dev)"
]
},
{
"cell_type": "code",
"execution_count": null,
2022-03-20 19:23:11 +01:00
"id": "stretch-career",
2022-03-20 17:35:07 +01:00
"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.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}