This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/AIandML/e1_python_basics/.ipynb_checkpoints/e1.3_pandas-checkpoint.ipynb

1177 lines
81 KiB
Text
Raw Normal View History

2022-10-15 14:46:19 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 人工智能与机器学习-实验1\n",
"## Part IV. Pandas库的使用\n",
"\n",
"|学号 |姓名 |\n",
"|----------|--------|\n",
"|***REMOVED***|***REMOVED***|\n",
"|2020113874|何一涛|\n",
"\n",
"本部分的实验,需要自己在网络学习相关基础函数使用。"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 1: 导入可能需要的库"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import numpy as np\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 2: 读取数据集"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"titanic = pd.read_csv('titanic.csv')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step3: 显示数据集的前5行和后5行"
]
},
{
"cell_type": "code",
"execution_count": 3,
"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>PassengerId</th>\n",
" <th>Survived</th>\n",
" <th>Pclass</th>\n",
" <th>Name</th>\n",
" <th>Sex</th>\n",
" <th>Age</th>\n",
" <th>SibSp</th>\n",
" <th>Parch</th>\n",
" <th>Ticket</th>\n",
" <th>Fare</th>\n",
" <th>Cabin</th>\n",
" <th>Embarked</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Braund, Mr. Owen Harris</td>\n",
" <td>male</td>\n",
" <td>22.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>A/5 21171</td>\n",
" <td>7.2500</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
" <td>female</td>\n",
" <td>38.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>PC 17599</td>\n",
" <td>71.2833</td>\n",
" <td>C85</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>Heikkinen, Miss. Laina</td>\n",
" <td>female</td>\n",
" <td>26.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>STON/O2. 3101282</td>\n",
" <td>7.9250</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
" <td>female</td>\n",
" <td>35.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>113803</td>\n",
" <td>53.1000</td>\n",
" <td>C123</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Allen, Mr. William Henry</td>\n",
" <td>male</td>\n",
" <td>35.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>373450</td>\n",
" <td>8.0500</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" PassengerId Survived Pclass \\\n",
"0 1 0 3 \n",
"1 2 1 1 \n",
"2 3 1 3 \n",
"3 4 1 1 \n",
"4 5 0 3 \n",
"\n",
" Name Sex Age SibSp \\\n",
"0 Braund, Mr. Owen Harris male 22.0 1 \n",
"1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 \n",
"2 Heikkinen, Miss. Laina female 26.0 0 \n",
"3 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 \n",
"4 Allen, Mr. William Henry male 35.0 0 \n",
"\n",
" Parch Ticket Fare Cabin Embarked \n",
"0 0 A/5 21171 7.2500 NaN S \n",
"1 0 PC 17599 71.2833 C85 C \n",
"2 0 STON/O2. 3101282 7.9250 NaN S \n",
"3 0 113803 53.1000 C123 S \n",
"4 0 373450 8.0500 NaN S "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic.head(5)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"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>PassengerId</th>\n",
" <th>Survived</th>\n",
" <th>Pclass</th>\n",
" <th>Name</th>\n",
" <th>Sex</th>\n",
" <th>Age</th>\n",
" <th>SibSp</th>\n",
" <th>Parch</th>\n",
" <th>Ticket</th>\n",
" <th>Fare</th>\n",
" <th>Cabin</th>\n",
" <th>Embarked</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>886</th>\n",
" <td>887</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>Montvila, Rev. Juozas</td>\n",
" <td>male</td>\n",
" <td>27.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>211536</td>\n",
" <td>13.00</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>887</th>\n",
" <td>888</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Graham, Miss. Margaret Edith</td>\n",
" <td>female</td>\n",
" <td>19.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>112053</td>\n",
" <td>30.00</td>\n",
" <td>B42</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>888</th>\n",
" <td>889</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Johnston, Miss. Catherine Helen \"Carrie\"</td>\n",
" <td>female</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>W./C. 6607</td>\n",
" <td>23.45</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>889</th>\n",
" <td>890</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Behr, Mr. Karl Howell</td>\n",
" <td>male</td>\n",
" <td>26.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>111369</td>\n",
" <td>30.00</td>\n",
" <td>C148</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>890</th>\n",
" <td>891</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Dooley, Mr. Patrick</td>\n",
" <td>male</td>\n",
" <td>32.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>370376</td>\n",
" <td>7.75</td>\n",
" <td>NaN</td>\n",
" <td>Q</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" PassengerId Survived Pclass Name \\\n",
"886 887 0 2 Montvila, Rev. Juozas \n",
"887 888 1 1 Graham, Miss. Margaret Edith \n",
"888 889 0 3 Johnston, Miss. Catherine Helen \"Carrie\" \n",
"889 890 1 1 Behr, Mr. Karl Howell \n",
"890 891 0 3 Dooley, Mr. Patrick \n",
"\n",
" Sex Age SibSp Parch Ticket Fare Cabin Embarked \n",
"886 male 27.0 0 0 211536 13.00 NaN S \n",
"887 female 19.0 0 0 112053 30.00 B42 S \n",
"888 female NaN 1 2 W./C. 6607 23.45 NaN S \n",
"889 male 26.0 0 0 111369 30.00 C148 C \n",
"890 male 32.0 0 0 370376 7.75 NaN Q "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic.tail(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 4: 该数据集有多少行和列?"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(891, 12)\n"
]
}
],
"source": [
"print(titanic.shape)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 5: 将PassengerID设置为索引"
]
},
{
"cell_type": "code",
"execution_count": 6,
"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>Survived</th>\n",
" <th>Pclass</th>\n",
" <th>Name</th>\n",
" <th>Sex</th>\n",
" <th>Age</th>\n",
" <th>SibSp</th>\n",
" <th>Parch</th>\n",
" <th>Ticket</th>\n",
" <th>Fare</th>\n",
" <th>Cabin</th>\n",
" <th>Embarked</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PassengerId</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Braund, Mr. Owen Harris</td>\n",
" <td>male</td>\n",
" <td>22.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>A/5 21171</td>\n",
" <td>7.2500</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
" <td>female</td>\n",
" <td>38.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>PC 17599</td>\n",
" <td>71.2833</td>\n",
" <td>C85</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>Heikkinen, Miss. Laina</td>\n",
" <td>female</td>\n",
" <td>26.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>STON/O2. 3101282</td>\n",
" <td>7.9250</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
" <td>female</td>\n",
" <td>35.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>113803</td>\n",
" <td>53.1000</td>\n",
" <td>C123</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Allen, Mr. William Henry</td>\n",
" <td>male</td>\n",
" <td>35.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>373450</td>\n",
" <td>8.0500</td>\n",
" <td>NaN</td>\n",
" <td>S</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",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>887</th>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>Montvila, Rev. Juozas</td>\n",
" <td>male</td>\n",
" <td>27.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>211536</td>\n",
" <td>13.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>888</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Graham, Miss. Margaret Edith</td>\n",
" <td>female</td>\n",
" <td>19.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>112053</td>\n",
" <td>30.0000</td>\n",
" <td>B42</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>889</th>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Johnston, Miss. Catherine Helen \"Carrie\"</td>\n",
" <td>female</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>W./C. 6607</td>\n",
" <td>23.4500</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>890</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Behr, Mr. Karl Howell</td>\n",
" <td>male</td>\n",
" <td>26.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>111369</td>\n",
" <td>30.0000</td>\n",
" <td>C148</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>891</th>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>Dooley, Mr. Patrick</td>\n",
" <td>male</td>\n",
" <td>32.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>370376</td>\n",
" <td>7.7500</td>\n",
" <td>NaN</td>\n",
" <td>Q</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>891 rows × 11 columns</p>\n",
"</div>"
],
"text/plain": [
" Survived Pclass \\\n",
"PassengerId \n",
"1 0 3 \n",
"2 1 1 \n",
"3 1 3 \n",
"4 1 1 \n",
"5 0 3 \n",
"... ... ... \n",
"887 0 2 \n",
"888 1 1 \n",
"889 0 3 \n",
"890 1 1 \n",
"891 0 3 \n",
"\n",
" Name Sex Age \\\n",
"PassengerId \n",
"1 Braund, Mr. Owen Harris male 22.0 \n",
"2 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 \n",
"3 Heikkinen, Miss. Laina female 26.0 \n",
"4 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 \n",
"5 Allen, Mr. William Henry male 35.0 \n",
"... ... ... ... \n",
"887 Montvila, Rev. Juozas male 27.0 \n",
"888 Graham, Miss. Margaret Edith female 19.0 \n",
"889 Johnston, Miss. Catherine Helen \"Carrie\" female NaN \n",
"890 Behr, Mr. Karl Howell male 26.0 \n",
"891 Dooley, Mr. Patrick male 32.0 \n",
"\n",
" SibSp Parch Ticket Fare Cabin Embarked \n",
"PassengerId \n",
"1 1 0 A/5 21171 7.2500 NaN S \n",
"2 1 0 PC 17599 71.2833 C85 C \n",
"3 0 0 STON/O2. 3101282 7.9250 NaN S \n",
"4 1 0 113803 53.1000 C123 S \n",
"5 0 0 373450 8.0500 NaN S \n",
"... ... ... ... ... ... ... \n",
"887 0 0 211536 13.0000 NaN S \n",
"888 0 0 112053 30.0000 B42 S \n",
"889 1 2 W./C. 6607 23.4500 NaN S \n",
"890 0 0 111369 30.0000 C148 C \n",
"891 0 0 370376 7.7500 NaN Q \n",
"\n",
"[891 rows x 11 columns]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic.set_index('PassengerId')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 6数据中有缺失值吗"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"PassengerId False\n",
"Survived False\n",
"Pclass False\n",
"Name False\n",
"Sex False\n",
"Age True\n",
"SibSp False\n",
"Parch False\n",
"Ticket False\n",
"Fare False\n",
"Cabin True\n",
"Embarked True\n",
"dtype: bool"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic.isnull().any()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 7: 乘客的最大年龄和最小年龄是多少?"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"80.0\n"
]
}
],
"source": [
"print(titanic['Age'].max())"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.42\n"
]
}
],
"source": [
"print(titanic['Age'].min())\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 8: 有多少人生还?"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"342\n"
]
}
],
"source": [
"survived = titanic[titanic['Survived'] == 1]\n",
"\n",
"print(survived.shape[0])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 9: 男性和女性的生还比例分别是多少?"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"male:0.18890814558058924\n"
]
}
],
"source": [
"male=titanic[titanic['Sex']=='male']\n",
"survived=male[male['Survived'] == 1]\n",
"print(\"male:\" ,end=\"\")\n",
"print(survived.shape[0]/male.shape[0])\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"female: 0.7420382165605095\n"
]
}
],
"source": [
"female=titanic[titanic['Sex']=='female']\n",
"survived=female[female['Survived'] == 1]\n",
"print(\"female: \",end=\"\")\n",
"print(survived.shape[0]/female.shape[0])\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 10: 按照船票价格降序排列"
]
},
{
"cell_type": "code",
"execution_count": 13,
"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>PassengerId</th>\n",
" <th>Survived</th>\n",
" <th>Pclass</th>\n",
" <th>Name</th>\n",
" <th>Sex</th>\n",
" <th>Age</th>\n",
" <th>SibSp</th>\n",
" <th>Parch</th>\n",
" <th>Ticket</th>\n",
" <th>Fare</th>\n",
" <th>Cabin</th>\n",
" <th>Embarked</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>258</th>\n",
" <td>259</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Ward, Miss. Anna</td>\n",
" <td>female</td>\n",
" <td>35.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>PC 17755</td>\n",
" <td>512.3292</td>\n",
" <td>NaN</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>737</th>\n",
" <td>738</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Lesurer, Mr. Gustave J</td>\n",
" <td>male</td>\n",
" <td>35.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>PC 17755</td>\n",
" <td>512.3292</td>\n",
" <td>B101</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>679</th>\n",
" <td>680</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Cardeza, Mr. Thomas Drake Martinez</td>\n",
" <td>male</td>\n",
" <td>36.0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>PC 17755</td>\n",
" <td>512.3292</td>\n",
" <td>B51 B53 B55</td>\n",
" <td>C</td>\n",
" </tr>\n",
" <tr>\n",
" <th>88</th>\n",
" <td>89</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Fortune, Miss. Mabel Helen</td>\n",
" <td>female</td>\n",
" <td>23.0</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>19950</td>\n",
" <td>263.0000</td>\n",
" <td>C23 C25 C27</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>28</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>Fortune, Mr. Charles Alexander</td>\n",
" <td>male</td>\n",
" <td>19.0</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>19950</td>\n",
" <td>263.0000</td>\n",
" <td>C23 C25 C27</td>\n",
" <td>S</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",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>633</th>\n",
" <td>634</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>Parr, Mr. William Henry Marsh</td>\n",
" <td>male</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>112052</td>\n",
" <td>0.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>413</th>\n",
" <td>414</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>Cunningham, Mr. Alfred Fleming</td>\n",
" <td>male</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>239853</td>\n",
" <td>0.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>822</th>\n",
" <td>823</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>Reuchlin, Jonkheer. John George</td>\n",
" <td>male</td>\n",
" <td>38.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>19972</td>\n",
" <td>0.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>732</th>\n",
" <td>733</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>Knight, Mr. Robert J</td>\n",
" <td>male</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>239855</td>\n",
" <td>0.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" <tr>\n",
" <th>674</th>\n",
" <td>675</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>Watson, Mr. Ennis Hastings</td>\n",
" <td>male</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>239856</td>\n",
" <td>0.0000</td>\n",
" <td>NaN</td>\n",
" <td>S</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>891 rows × 12 columns</p>\n",
"</div>"
],
"text/plain": [
" PassengerId Survived Pclass Name \\\n",
"258 259 1 1 Ward, Miss. Anna \n",
"737 738 1 1 Lesurer, Mr. Gustave J \n",
"679 680 1 1 Cardeza, Mr. Thomas Drake Martinez \n",
"88 89 1 1 Fortune, Miss. Mabel Helen \n",
"27 28 0 1 Fortune, Mr. Charles Alexander \n",
".. ... ... ... ... \n",
"633 634 0 1 Parr, Mr. William Henry Marsh \n",
"413 414 0 2 Cunningham, Mr. Alfred Fleming \n",
"822 823 0 1 Reuchlin, Jonkheer. John George \n",
"732 733 0 2 Knight, Mr. Robert J \n",
"674 675 0 2 Watson, Mr. Ennis Hastings \n",
"\n",
" Sex Age SibSp Parch Ticket Fare Cabin Embarked \n",
"258 female 35.0 0 0 PC 17755 512.3292 NaN C \n",
"737 male 35.0 0 0 PC 17755 512.3292 B101 C \n",
"679 male 36.0 0 1 PC 17755 512.3292 B51 B53 B55 C \n",
"88 female 23.0 3 2 19950 263.0000 C23 C25 C27 S \n",
"27 male 19.0 3 2 19950 263.0000 C23 C25 C27 S \n",
".. ... ... ... ... ... ... ... ... \n",
"633 male NaN 0 0 112052 0.0000 NaN S \n",
"413 male NaN 0 0 239853 0.0000 NaN S \n",
"822 male 38.0 0 0 19972 0.0000 NaN S \n",
"732 male NaN 0 0 239855 0.0000 NaN S \n",
"674 male NaN 0 0 239856 0.0000 NaN S \n",
"\n",
"[891 rows x 12 columns]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"titanic.sort_values(by='Fare', ascending=False)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 11: 绘制一个展示船票价格的直方图"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: ylabel='Frequency'>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1IAAAGsCAYAAADXIZZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9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
"text/plain": [
"<Figure size 1000x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"titanic['Fare'].plot(kind='hist', bins=20, figsize=(10, 5))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 12: 绘制乘客年龄与船票价格的散点图"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: xlabel='Age', ylabel='Fare'>"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1IAAAHACAYAAACoF1lmAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAABgoUlEQVR4nO3deXwV9b3/8fchgUACWchCREFBUhAVRVSICG4U2tJbudJey8MqbbW9pXFfqt5arVbF6m17K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tRvEL/394m1gyMjKUnZ0d9QcAAAAAphIWSF1wwQVat26d1q5dG/k7/fTTdckll0T+u2fPnlq0aFHk36xfv15btmxRaWmpJKm0tFTr1q1TdXV1ZJuFCxcqOztbI0eO9P2cAAAAAHQPCesj1a9fP5100klRy7KyspSfnx9Zfvnll+v6669X//79lZ2drauuukqlpaUaN26cJGny5MkaOXKkLr30Ut1///2qqqrSbbfdprKyMmVkZPh+TgAAAAC6h4QONuHkV7/6lXr06KHp06erqalJU6ZM0UMPPRRZn5aWppdfflmzZs1SaWmpsrKyNHPmTN11110JTDUAAACAVBeyLMtKdCISrb6+Xjk5Oaqrq6O/FAAAANCNmcYGCZ9HCgAAAACSDYEUAAAAALhEIAUAAAAALhFIAQAAAIBLBFIAAAAA4BKBFAAAAAC4RCAFAAAAAC4RSAEAAACASwRSAAAAAOASgRQAAAAAuEQgBQAAAAAuEUgBAAAAgEsEUgAAAADgEoEUAAAAALh
"text/plain": [
"<Figure size 1000x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"titanic.plot(kind='scatter', x='Age', y='Fare', figsize=(10, 5))\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.7"
},
"vscode": {
"interpreter": {
"hash": "1f0d395e06aa83586067b19165efc9b683889967164248deef4bbf1fa27cfb00"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}