You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

898 lines
57 KiB

5 years ago
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>探索性数据分析(EDA) · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="../gitbook/style.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-katex/katex.min.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="feature engerning.html" />
<link rel="prev" href="introduction.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="../">
<a href="../">
简介
</a>
</li>
5 years ago
<li class="chapter " data-level="1.2" data-path="../machine_learning.html">
<a href="../machine_learning.html">
机器学习概述
</a>
</li>
<li class="chapter " data-level="1.3" data-path="../algorithm.html">
<a href="../algorithm.html">
常见机器学习算法
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="../kNN.html">
<a href="../kNN.html">
近朱者赤近墨者黑-kNN
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="../linear_regression.html">
<a href="../linear_regression.html">
最简单的回归算法-线性回归
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="../logistic_regression.html">
<a href="../logistic_regression.html">
使用回归的思想进行分类-逻辑回归
</a>
</li>
<li class="chapter " data-level="1.3.4" data-path="../decision_tree.html">
<a href="../decision_tree.html">
最接近人类思维的算法-决策树
</a>
</li>
<li class="chapter " data-level="1.3.5" data-path="../random_forest.html">
<a href="../random_forest.html">
群众的力量是伟大的-随机森林
</a>
</li>
<li class="chapter " data-level="1.3.6" data-path="../kMeans.html">
<a href="../kMeans.html">
物以类聚人以群分-kMeans
</a>
</li>
<li class="chapter " data-level="1.3.7" data-path="../AGNES.html">
<a href="../AGNES.html">
以距离为尺-AGNES
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="../metrics.html">
<a href="../metrics.html">
模型评估指标
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="../classification_metrics.html">
<a href="../classification_metrics.html">
分类性能评估指标
</a>
</li>
<li class="chapter " data-level="1.4.2" data-path="../regression_metrics.html">
<a href="../regression_metrics.html">
回归性能评估指标
</a>
</li>
<li class="chapter " data-level="1.4.3" data-path="../cluster_metrics.html">
<a href="../cluster_metrics.html">
聚类性能评估指标
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.5" data-path="../sklearn.html">
<a href="../sklearn.html">
使用sklearn进行机器学习
</a>
</li>
<li class="chapter " data-level="1.6" >
<span>
综合实战案例
</span>
<ul class="articles">
<li class="chapter " data-level="1.6.1" >
5 years ago
<span>
泰坦尼克生还预测
</span>
<ul class="articles">
5 years ago
<li class="chapter " data-level="1.6.1.1" data-path="introduction.html">
5 years ago
<a href="introduction.html">
简介
</a>
</li>
5 years ago
<li class="chapter active" data-level="1.6.1.2" data-path="EDA.html">
5 years ago
<a href="EDA.html">
探索性数据分析(EDA)
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6.1.3" data-path="feature engerning.html">
5 years ago
<a href="feature engerning.html">
特征工程
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6.1.4" data-path="fit and predict.html">
5 years ago
<a href="fit and predict.html">
构建模型进行预测
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6.1.5" data-path="tuning.html">
5 years ago
<a href="tuning.html">
调参
</a>
</li>
</ul>
</li>
5 years ago
<li class="chapter " data-level="1.6.2" >
5 years ago
<span>
使用强化学习玩乒乓球游戏
</span>
<ul class="articles">
5 years ago
<li class="chapter " data-level="1.6.2.1" data-path="../pingpong/what is reinforce learning.html">
5 years ago
<a href="../pingpong/what is reinforce learning.html">
什么是强化学习
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6.2.2" data-path="../pingpong/Policy Gradient.html">
5 years ago
<a href="../pingpong/Policy Gradient.html">
Policy Gradient原理
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6.2.3" data-path="../pingpong/coding.html">
5 years ago
<a href="../pingpong/coding.html">
使用Policy Gradient玩乒乓球游戏
</a>
</li>
</ul>
</li>
5 years ago
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="../recommand.html">
<a href="../recommand.html">
实训推荐
</a>
</li>
5 years ago
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href=".." >探索性数据分析(EDA)</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="&#x63A2;&#x7D22;&#x6027;&#x6570;&#x636E;&#x5206;&#x6790;eda">&#x63A2;&#x7D22;&#x6027;&#x6570;&#x636E;&#x5206;&#x6790;(EDA)</h1>
<p>&#x63A2;&#x7D22;&#x6027;&#x6570;&#x636E;&#x5206;&#x6790;(EDA)&#x8BF4;&#x767D;&#x4E86;&#x5C31;&#x662F;&#x901A;&#x8FC7;&#x53EF;&#x89C6;&#x5316;&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x770B;&#x770B;&#x6570;&#x636E;&#x4E2D;&#x7279;&#x5F81;&#x4E0E;&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#xFF0C;&#x7279;&#x5F81;&#x4E0E;&#x76EE;&#x6807;&#x4E4B;&#x95F4;&#x7684;&#x6F5C;&#x5728;&#x5173;&#x7CFB;&#xFF0C;&#x770B;&#x770B;&#x6709;&#x4EC0;&#x4E48;&#x6709;&#x7528;&#x7684;&#x7EBF;&#x7D22;&#x53EF;&#x4EE5;&#x6316;&#x6398;&#xFF0C;&#x4F8B;&#x5982;&#x54EA;&#x4E9B;&#x6570;&#x636E;&#x662F;&#x566A;&#x58F0;&#xFF0C;&#x6709;&#x54EA;&#x4E9B;&#x7279;&#x5F81;&#x7684;&#x76F8;&#x5173;&#x6027;&#x6BD4;&#x8F83;&#x4F4E;&#xFF0C;&#x540E;&#x7EED;&#x53EF;&#x4EE5;&#x9020;&#x51FA;&#x54EA;&#x4E9B;&#x65B0;&#x7684;&#x7279;&#x5F81;&#x7B49;&#x3002;</p>
<h2 id="&#x521D;&#x7AA5;">&#x521D;&#x7AA5;</h2>
<p>&#x5F53;&#x7136;&#xFF0C;&#x5728;EDA&#x4E4B;&#x524D;&#x5148;&#x8981;&#x52A0;&#x8F7D;&#x6570;&#x636E;&#xFF0C;&#x6211;&#x4EEC;&#x4E0D;&#x59A8;&#x5148;&#x5C06;&#x8BAD;&#x7EC3;&#x96C6;train.csv&#x8BFB;&#x5230;&#x5185;&#x5B58;&#x4E2D;&#xFF0C;&#x5E76;&#x770B;&#x4E00;&#x770B;&#x3002;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
<span class="hljs-keyword">import</span> seaborn <span class="hljs-keyword">as</span> sns
data=pd.read_csv(<span class="hljs-string">&apos;./Titanic/train.csv&apos;</span>)
<span class="hljs-comment"># &#x770B;&#x770B;data&#x7684;&#x524D;5&#x884C;</span>
data.head()
</code></pre>
<p><img src="../img/32.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x6570;&#x636E;&#x662F;&#x7531; 11 &#x4E2A;&#x7279;&#x5F81;&#x548C; 1 &#x4E2A;&#x6807;&#x7B7E;(Survived)&#x7EC4;&#x6210;&#x7684;&#x3002;&#x5176;&#x4E2D;&#x5404;&#x4E2A;&#x7279;&#x5F81;&#x548C;&#x6807;&#x7B7E;&#x7684;&#x610F;&#x4E49;&#x5982;&#x4E0B;:</p>
<table>
<thead>
<tr>
<th>&#x7279;&#x5F81;</th>
<th>&#x610F;&#x4E49;</th>
</tr>
</thead>
<tbody>
<tr>
<td>Survived</td>
<td>&#x662F;&#x5426;&#x751F;&#x8FD8;&#xFF0C;1&#x8868;&#x793A;&#x662F;&#xFF0C;0&#x8868;&#x793A;&#x5426;</td>
</tr>
<tr>
<td>PassengerId</td>
<td>&#x4E58;&#x5BA2;ID</td>
</tr>
<tr>
<td>Pclass</td>
<td>&#x8239;&#x7968;&#x7C7B;&#x578B;&#xFF0C; &#x603B;&#x5171;3&#x79CD;&#x7C7B;&#x578B;&#xFF1A;1(&#x4E00;&#x7B49;&#x8231;)&#xFF0C;2(&#x4E8C;&#x7B49;&#x8231;)&#xFF0C;3(&#x4E09;&#x7B49;&#x8231;)</td>
</tr>
<tr>
<td>Name</td>
<td>&#x8239;&#x5BA2;&#x59D3;&#x540D;</td>
</tr>
<tr>
<td>Sex</td>
<td>&#x8239;&#x5BA2;&#x6027;&#x522B;&#xFF1A;female&#xFF0C;male</td>
</tr>
<tr>
<td>Age</td>
<td>&#x8239;&#x5BA2;&#x5E74;&#x9F84;</td>
</tr>
<tr>
<td>SibSp</td>
<td>&#x8239;&#x5BA2;&#x7684;&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x59BB;&#x5B50;&#x4E08;&#x592B;&#x7684;&#x6570;&#x91CF;</td>
</tr>
<tr>
<td>Parch</td>
<td>&#x8239;&#x5BA2;&#x7684;&#x7236;&#x6BCD;&#xFF0C;&#x5B69;&#x5B50;&#x7684;&#x6570;&#x91CF;</td>
</tr>
<tr>
<td>Ticket</td>
<td>&#x8239;&#x7968;</td>
</tr>
<tr>
<td>Fare</td>
<td>&#x8239;&#x5BA2;&#x5728;&#x8239;&#x4E0A;&#x6240;&#x82B1;&#x7684;&#x94B1;</td>
</tr>
<tr>
<td>Cabin</td>
<td>&#x8239;&#x5BA2;&#x7684;&#x8239;&#x8231;&#x53F7;</td>
</tr>
<tr>
<td>Embarked</td>
<td>&#x8239;&#x5BA2;&#x767B;&#x8239;&#x7684;&#x53E3;&#x5CB8;&#xFF1A;C&#xFF0C;Q&#xFF0C;S</td>
</tr>
</tbody>
</table>
<p>&#x4E86;&#x89E3;&#x4E86;&#x6570;&#x636E;&#x79CD;&#x5404;&#x4E2A;&#x5C5E;&#x6027;&#x7684;&#x542B;&#x4E49;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x770B;&#x8FD9;&#x4E2A;&#x6570;&#x636E;&#x96C6;&#x4E2D;&#x6709;&#x6CA1;&#x6709;&#x7F3A;&#x5931;&#x503C;&#x3002;</p>
<pre><code class="lang-python">data.isnull().sum()
</code></pre>
<p><img src="../img/33.jpg" alt=""></p>
<p>&#x53EF;&#x4EE5;&#x770B;&#x51FA; Age&#xFF0C;Cabin &#x548C; Embarked &#x8FD9;&#x4E09;&#x4E2A;&#x7279;&#x5F81;&#x4E2D;&#x6709;&#x7F3A;&#x5931;&#x503C;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5904;&#x7406;&#x8FD9;&#x4E9B;&#x7F3A;&#x5931;&#x503C;&#x3002;&#x600E;&#x6837;&#x5904;&#x7406;&#x5462;&#xFF1F;&#x5148;&#x4E0D;&#x7740;&#x6025;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5148;&#x770B;&#x770B;&#x6570;&#x636E;&#x4E2D;&#x6709;&#x54EA;&#x4E9B;&#x4FE1;&#x606F;&#x53EF;&#x4EE5;&#x6316;&#x6398;&#x3002;</p>
<h2 id="&#x6709;&#x591A;&#x5C11;&#x4EBA;&#x6D3B;&#x4E86;&#x4E0B;&#x6765;">&#x6709;&#x591A;&#x5C11;&#x4EBA;&#x6D3B;&#x4E86;&#x4E0B;&#x6765;</h2>
<p>&#x6211;&#x4EEC;&#x9996;&#x5148;&#x53EF;&#x4EE5;&#x770B;&#x770B;&#x8BAD;&#x7EC3;&#x96C6;&#x4E2D;&#x6709;&#x591A;&#x5C11;&#x4EBA;&#x6D3B;&#x4E86;&#x4E0B;&#x6765;&#x3002;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">18</span>,<span class="hljs-number">8</span>))
<span class="hljs-comment"># &#x751F;&#x8FD8;&#x6BD4;&#x4F8B;&#x997C;&#x56FE;</span>
data[<span class="hljs-string">&apos;Survived&apos;</span>].value_counts().plot.pie(explode=[<span class="hljs-number">0</span>,<span class="hljs-number">0.1</span>],autopct=<span class="hljs-string">&apos;%1.1f%%&apos;</span>,ax=ax[<span class="hljs-number">0</span>],shadow=<span class="hljs-keyword">True</span>)
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Survived&apos;</span>)
ax[<span class="hljs-number">0</span>].set_ylabel(<span class="hljs-string">&apos;&apos;</span>)
<span class="hljs-comment"># &#x751F;&#x8FD8;&#x6570;&#x91CF;&#x76F4;&#x65B9;&#x56FE;</span>
sns.countplot(<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Survived&apos;</span>)
plt.show()
</code></pre>
<p><img src="../img/34.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x6CF0;&#x5766;&#x5C3C;&#x514B;&#x6C89;&#x8239;&#x4E8B;&#x4EF6;&#x4E2D;&#x8FD8;&#x662F;&#x51F6;&#x591A;&#x5409;&#x5C11;&#x7684;&#x3002;&#x56E0;&#x4E3A;&#x5728; 891 &#x540D;&#x8239;&#x5BA2;&#x4E2D;&#xFF0C;&#x53EA;&#x6709;&#x7EA6; 38% &#x5DE6;&#x53F3;&#x7684;&#x4EBA;&#x5E78;&#x514D;&#x4E8E;&#x96BE;&#xFF0C;&#x90A3;&#x4E48;&#x63A5;&#x4E0B;&#x6765;&#x5C1D;&#x8BD5;&#x4F7F;&#x7528;&#x6570;&#x636E;&#x96C6;&#x4E2D;&#x4E0D;&#x540C;&#x7684;&#x7279;&#x5F81;&#xFF0C;&#x6765;&#x770B;&#x770B;&#x4ED6;&#x4EEC;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6709;&#x591A;&#x5C11;&#x3002;&#x5176;&#x5B9E;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x8FC7;&#x7A0B;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x5927;&#x6982;&#x6709;&#x54EA;&#x4E9B;&#x7C7B;&#x578B;&#x7684;&#x8239;&#x5BA2;&#x6D3B;&#x4E86;&#x4E0B;&#x6765;&#x3002;</p>
<h2 id="&#x6027;&#x522B;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x6027;&#x522B;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x9996;&#x5148;&#xFF0C;&#x770B;&#x770B;&#x4E0D;&#x540C;&#x6027;&#x522B;&#x7684;&#x751F;&#x8FD8;&#x8005;&#x6570;&#x91CF;&#x3002;</p>
<pre><code class="lang-python">data.groupby([<span class="hljs-string">&apos;Sex&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>])[<span class="hljs-string">&apos;Survived&apos;</span>].count()
</code></pre>
<p><img src="../img/35.jpg" alt=""></p>
<p>&#x770B;&#x4E0A;&#x53BB;&#x597D;&#x60F3;&#x5973;&#x6027;&#x8239;&#x5BA2;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x9AD8;&#x4E00;&#x4E9B;&#xFF0C;&#x6211;&#x4EEC;&#x4E0D;&#x59A8;&#x518D;&#x53EF;&#x89C6;&#x5316;&#x4E00;&#x4E0B;&#x3002;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">18</span>,<span class="hljs-number">8</span>))
data[[<span class="hljs-string">&apos;Sex&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>]].groupby([<span class="hljs-string">&apos;Sex&apos;</span>]).mean().plot.bar(ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Survived vs Sex&apos;</span>)
sns.countplot(<span class="hljs-string">&apos;Sex&apos;</span>,hue=<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Sex:Survived vs Dead&apos;</span>)
plt.show()
</code></pre>
<p><img src="../img/36.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x6709;&#x8DA3;&#x7684;&#x73B0;&#x8C61;&#xFF0C;&#x8239;&#x4E0A;&#x7684;&#x7537;&#x4EBA;&#x662F;&#x6BD4;&#x5973;&#x4EBA;&#x591A;&#x4E86; 200 &#x591A;&#x4EBA;&#xFF0C;&#x4F46;&#x662F;&#x5973;&#x4EBA;&#x751F;&#x8FD8;&#x7684;&#x4EBA;&#x6570;&#x51E0;&#x4E4E;&#x662F;&#x7537;&#x4EBA;&#x751F;&#x8FD8;&#x7684;&#x4EBA;&#x6570;&#x7684;&#x4E24;&#x500D;&#xFF0C;&#x5973;&#x4EBA;&#x7684;&#x5B58;&#x6D3B;&#x7387;&#x7EA6;&#x4E3A; 75% &#xFF0C;&#x800C;&#x7537;&#x4EBA;&#x7684;&#x5B58;&#x6D3B;&#x7387;&#x7EA6;&#x4E3A; 19% &#x7684;&#x6837;&#x5B50;&#x3002;&#x6240;&#x4EE5; Sex &#x8FD9;&#x4E2A;&#x7279;&#x5F81;&#x5E94;&#x8BE5;&#x662F;&#x4E00;&#x4E2A;&#x80FD;&#x591F;&#x5F88;&#x597D;&#x7684;&#x533A;&#x5206;&#x4E00;&#x4E2A;&#x4EBA;&#x662F;&#x5426;&#x751F;&#x8FD8;&#x7684;&#x7279;&#x5F81;&#x3002;&#x800C;&#x4E14;&#x5BF9;&#x4E8E;&#x751F;&#x8FD8;&#x6765;&#x8BF4;&#xFF0C;&#x597D;&#x50CF;&#x662F;&#x5973;&#x58EB;&#x4F18;&#x5148;&#x3002;</p>
<h2 id="&#x8239;&#x7968;&#x7C7B;&#x578B;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x8239;&#x7968;&#x7C7B;&#x578B;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x8239;&#x7968;&#x7C7B;&#x578B;&#x5206;&#x4E09;&#x4E2A;&#x6863;&#x6B21;&#xFF0C;&#x5176;&#x4E2D; 1 &#x4E3A;&#x4E00;&#x7B49;&#x8231;&#xFF0C; 2 &#x4E3A;&#x4E8C;&#x7B49;&#x8231;&#xFF0C; 3 &#x4E3A;&#x4E09;&#x7B49;&#x8231;&#x3002;&#x65E2;&#x7136;&#x8239;&#x8231;&#x5206;&#x4E09;&#x516D;&#x4E5D;&#x7B49;&#xFF0C;&#x90A3;&#x4E48;&#x662F;&#x4E0D;&#x662F;&#x8D8A;&#x9AD8;&#x7EA7;&#x7684;&#x8231;&#xFF0C;&#x5B83;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x8D8A;&#x9AD8;&#x5462;&#xFF1F;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">18</span>,<span class="hljs-number">8</span>))
data[<span class="hljs-string">&apos;Pclass&apos;</span>].value_counts().plot.bar(ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Number Of Passengers By Pclass&apos;</span>)
ax[<span class="hljs-number">0</span>].set_ylabel(<span class="hljs-string">&apos;Count&apos;</span>)
sns.countplot(<span class="hljs-string">&apos;Pclass&apos;</span>,hue=<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Pclass:Survived vs Dead&apos;</span>)
plt.show()
</code></pre>
<p><img src="../img/37.jpg" alt=""></p>
<p>&#x867D;&#x7136;&#x8BF4;&#x94B1;&#x4E0D;&#x662F;&#x4E07;&#x80FD;&#x7684;&#xFF0C;&#x4F46;&#x4ECE;&#x53EF;&#x89C6;&#x5316;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x4E00;&#x7B49;&#x8231;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x9AD8;&#xFF0C;&#x5927;&#x4E8E;&#x4E3A; 63%&#xFF0C;&#x4E8C;&#x7B49;&#x8231;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x7EA6;&#x4E3A; 48% &#xFF0C;&#x800C;&#x4E14;&#x867D;&#x7136;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x4EBA;&#x6570;&#x662F;&#x6700;&#x591A;&#x7684;&#xFF0C;&#x4F46;&#x751F;&#x8FD8;&#x7387;&#x786E;&#x662F;&#x6700;&#x4F4E;&#x7684;&#x3002;&#x6240;&#x4EE5;&#x4E0D;&#x96BE;&#x770B;&#x51FA;&#xFF0C;&#x91D1;&#x94B1;&#x5730;&#x4F4D;&#x8FD8;&#x662F;&#x5F88;&#x91CD;&#x8981;&#x7684;&#xFF0C;&#x4E5F;&#x8BB8;&#x4E00;&#x7B49;&#x8231;&#x5468;&#x56F4;&#x6709;&#x6BD4;&#x8F83;&#x591A;&#x7684;&#x6551;&#x751F;&#x8BBE;&#x5907;&#x3002;</p>
<h2 id="&#x4E0A;&#x6D41;&#x5973;&#x6027;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x4E0A;&#x6D41;&#x5973;&#x6027;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x4ECE;&#x524D;&#x4E24;&#x6B21;&#x53EF;&#x89C6;&#x5316;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x5973;&#x6027;&#xFF0C;&#x4E0A;&#x6D41;&#x4EBA;&#x58EB;&#x6210;&#x4E3A;&#x4E86;&#x662F;&#x5426;&#x80FD;&#x591F;&#x6D3B;&#x4E0B;&#x6765;&#x7684;&#x5173;&#x952E;&#xFF0C;&#x90A3;&#x4E48;&#x4E0A;&#x6D41;&#x5973;&#x6027;(&#x4E24;&#x8005;&#x7684;&#x7ED3;&#x5408;)&#x7684;&#x751F;&#x8FD8;&#x7387;&#x4F1A;&#x4E0D;&#x4F1A;&#x5F88;&#x9AD8;&#x5462;&#xFF1F;</p>
<pre><code class="lang-python">sns.factorplot(<span class="hljs-string">&apos;Pclass&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,hue=<span class="hljs-string">&apos;Sex&apos;</span>,data=data)
plt.show()
</code></pre>
<p><img src="../img/38.jpg" alt=""></p>
<p>&#x4ECE;&#x8FD9;&#x5F20;&#x56FE;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x4E00;&#x7B49;&#x8231;&#x7684;&#x5973;&#x6027;(&#x4E0A;&#x6D41;&#x5973;&#x6027;)&#x7684;&#x751F;&#x8FD8;&#x7387;&#x975E;&#x5E38;&#x9AD8;&#xFF01;&#x51E0;&#x4E4E;&#x63A5;&#x8FD1;&#x4E86;&#x767E;&#x5206;&#x4E4B;&#x767E;&#xFF01;&#x800C;&#x4E14;&#x4E8C;&#x7B49;&#x8231;&#x548C;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x5973;&#x6027;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x4E5F;&#x8FDC;&#x6BD4;&#x7537;&#x6027;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x9AD8;&#x3002;&#x8FD9;&#x4E5F;&#x9A8C;&#x8BC1;&#x4E86;&#x6211;&#x4EEC;&#x7684;&#x731C;&#x6D4B;&#xFF0C;&#x5728;&#x6C89;&#x8239;&#x540E;&#x662F;&#x4F18;&#x5148;&#x5973;&#x6027;&#x548C;&#x4E00;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x7684;&#x3002;</p>
<h2 id="&#x5E74;&#x9F84;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x5E74;&#x9F84;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x9996;&#x5148;&#x53EF;&#x4EE5;&#x5148;&#x770B;&#x4E00;&#x4E0B;&#x8BAD;&#x7EC3;&#x96C6;&#x4E2D;&#x8239;&#x5BA2;&#x7684;&#x5E74;&#x9F84;&#x7684;&#x6700;&#x503C;&#x548C;&#x5747;&#x503C;&#x3002;</p>
<pre><code class="lang-python">print(<span class="hljs-string">&apos;Oldest Passenger was of:&apos;</span>,data[<span class="hljs-string">&apos;Age&apos;</span>].max(),<span class="hljs-string">&apos;Years&apos;</span>)
print(<span class="hljs-string">&apos;Youngest Passenger was of:&apos;</span>,data[<span class="hljs-string">&apos;Age&apos;</span>].min(),<span class="hljs-string">&apos;Years&apos;</span>)
print(<span class="hljs-string">&apos;Average Age on the ship:&apos;</span>,data[<span class="hljs-string">&apos;Age&apos;</span>].mean(),<span class="hljs-string">&apos;Years&apos;</span>)
</code></pre>
<p><img src="../img/39.jpg" alt=""></p>
<p>&#x5E74;&#x7EAA;&#x6700;&#x5927;&#x7684;&#x662F;80&#x5C81;&#x7684;&#x8001;&#x7237;&#x7237;&#x6216;&#x8005;&#x8001;&#x592A;&#x592A;&#xFF0C;&#x6700;&#x5C0F;&#x7684;&#x662F;&#x521A;&#x51FA;&#x751F;&#x7684;&#x5C0F; baby&#xFF0C; &#x5E73;&#x5747;&#x5E74;&#x9F84;&#x5FEB; 30 &#x5C81;&#x3002;&#x8FD9;&#x4E2A;&#x8FD8;&#x662F;&#x7B26;&#x5408;&#x5E38;&#x7406;&#x7684;&#x3002;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x770B;&#x770B;&#x8239;&#x8231;&#x7B49;&#x7EA7;&#xFF0C;&#x5E74;&#x9F84;&#x548C;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;&#xFF0C;&#x4EE5;&#x53CA;&#x6027;&#x522B;&#xFF0C;&#x5E74;&#x9F84;&#x548C;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;&#x3002;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">18</span>,<span class="hljs-number">8</span>))
sns.violinplot(<span class="hljs-string">&quot;Pclass&quot;</span>,<span class="hljs-string">&quot;Age&quot;</span>, hue=<span class="hljs-string">&quot;Survived&quot;</span>, data=data,split=<span class="hljs-keyword">True</span>,ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Pclass and Age vs Survived&apos;</span>)
ax[<span class="hljs-number">0</span>].set_yticks(range(<span class="hljs-number">0</span>,<span class="hljs-number">110</span>,<span class="hljs-number">10</span>))
sns.violinplot(<span class="hljs-string">&quot;Sex&quot;</span>,<span class="hljs-string">&quot;Age&quot;</span>, hue=<span class="hljs-string">&quot;Survived&quot;</span>, data=data,split=<span class="hljs-keyword">True</span>,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Sex and Age vs Survived&apos;</span>)
ax[<span class="hljs-number">1</span>].set_yticks(range(<span class="hljs-number">0</span>,<span class="hljs-number">110</span>,<span class="hljs-number">10</span>))
plt.show()
</code></pre>
<p><img src="../img/40.jpg" alt=""></p>
<p>&#x4ECE;&#x53EF;&#x89C6;&#x5316;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF1A;</p>
<ul>
<li><p>&#x513F;&#x7AE5;&#x7684;&#x6570;&#x91CF;&#x968F;&#x7740;&#x8239;&#x8231;&#x7B49;&#x7EA7;&#x7684;&#x589E;&#x52A0;&#x800C;&#x589E;&#x52A0;&#xFF0C;10 &#x5C81;&#x4EE5;&#x4E0B;&#x7684;&#x5C0F;&#x670B;&#x53CB;&#x5B58;&#x6D3B;&#x7387;&#x4EFF;&#x4F5B;&#x90FD;&#x8FD8;&#x633A;&#x9AD8;&#x7684;&#xFF0C;&#x8DDF;&#x8239;&#x8231;&#x7B49;&#x7EA7;&#x597D;&#x50CF;&#x6CA1;&#x6709;&#x592A;&#x5927;&#x5173;&#x7CFB;&#x3002;</p>
</li>
<li><p>&#x6765;&#x81EA;&#x4E00;&#x7B49;&#x8231;&#x7684; 20-50 &#x5C81;&#x7684;&#x8239;&#x5BA2;&#x7684;&#x5B58;&#x6D3B;&#x7387;&#x5F88;&#x9AD8;&#xFF0C;&#x800C;&#x4E14;&#x5BF9;&#x5973;&#x6027;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x4E00;&#x5982;&#x65E2;&#x5F80;&#x7684;&#x9AD8;&#x3002;</p>
</li>
<li><p>&#x5BF9;&#x4E8E;&#x7537;&#x6027;&#x6765;&#x8BF4;&#xFF0C;&#x5E74;&#x7EAA;&#x8D8A;&#x5927;&#xFF0C;&#x751F;&#x8FD8;&#x7387;&#x8D8A;&#x4F4E;&#x3002;</p>
</li>
</ul>
<p>&#x4E0D;&#x8FC7;&#x6211;&#x4EEC;&#x7684;&#x5E74;&#x9F84;&#x662F;&#x6709;&#x7F3A;&#x5931;&#x503C;&#x7684;&#xFF0C;&#x5982;&#x679C;&#x56FE;&#x7B80;&#x5355;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5E73;&#x5747;&#x5E74;&#x9F84;&#x6765;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x7684;&#x5E74;&#x9F84;&#x3002;&#x4F46;&#x662F;&#x8FD9;&#x6837;&#x505A;&#x5E76;&#x4E0D;&#x5408;&#x9002;&#xFF0C;&#x6BD4;&#x5982;&#x4EBA;&#x5BB6;&#x53EA;&#x662F;&#x4E2A; 5 &#x5C81;&#x7684;&#x5C0F;&#x5C41;&#x5B69;&#xFF0C;&#x4F46;&#x662F;&#x4F60;&#x628A;&#x4EBA;&#x5BB6;&#x5F3A;&#x884C;&#x6539;&#x6210; 29 &#x5C81;&#x663E;&#x7136;&#x662F;&#x4E0D;&#x5408;&#x9002;&#x7684;&#x3002;&#x90A3;&#x6709;&#x6CA1;&#x6709;&#x80FD;&#x591F;&#x66F4;&#x52A0;&#x51C6;&#x786E;&#x5730;&#x77E5;&#x9053;&#x7F3A;&#x5931;&#x7684;&#x5E74;&#x9F84;&#x662F;&#x591A;&#x5C11;&#x7684;&#x65B9;&#x6CD5;&#x5462;&#xFF1F;&#x6709;&#xFF01;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x59D3;&#x540D;&#x6765;&#x63A8;&#x65AD;&#x7F3A;&#x5931;&#x7684;&#x5E74;&#x9F84;&#xFF0C;&#x56E0;&#x4E3A;&#x59D3;&#x540D;&#x4E2D;&#x6709;&#x5F88;&#x591A;&#x7C7B;&#x4F3C; Mr &#x6216;&#x8005; Mrs &#x8FD9;&#x6837;&#x7684;&#x524D;&#x7F00;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x59D3;&#x540D;&#x7684;&#x524D;&#x7F00;&#x6765;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x7684;&#x5E74;&#x9F84;&#x3002;</p>
<h2 id="&#x586B;&#x5145;&#x7F3A;&#x5931;&#x5E74;&#x9F84;">&#x586B;&#x5145;&#x7F3A;&#x5931;&#x5E74;&#x9F84;</h2>
<p>&#x5916;&#x56FD;&#x4EBA;&#x7684;&#x59D3;&#x540D;&#x548C;&#x6211;&#x4EEC;&#x4E2D;&#x56FD;&#x4EBA;&#x7684;&#x59D3;&#x540D;&#x4E0D;&#x592A;&#x4E00;&#x6837;&#xFF0C;&#x4E00;&#x822C;&#x90FD;&#x4F1A;&#x6709; Mr &#x3001; Mrs &#x3001;Miss &#x3001;Dr &#x7B49;&#x7279;&#x6B8A;&#x524D;&#x7F00;&#x3002;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5148;&#x63D0;&#x53D6;&#x59D3;&#x540D;&#x4E2D;&#x7684;&#x524D;&#x7F00;&#x3002;</p>
<pre><code class="lang-python">data[<span class="hljs-string">&apos;Initial&apos;</span>]=<span class="hljs-number">0</span>
<span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> data:
data[<span class="hljs-string">&apos;Initial&apos;</span>]=data.Name.str.extract(<span class="hljs-string">&apos;([A-Za-z]+)\.&apos;</span>)
</code></pre>
<p>&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x80FD;&#x591F;&#x63D0;&#x53D6;&#x51FA;&#x8BF8;&#x5982;&#xFF1A;Capt &#x3001;Col &#x3001;Don &#x3001;Lady &#x3001;Major &#x3001;Sir &#x7B49;&#x524D;&#x7F00;&#xFF0C;&#x63A5;&#x7740;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;&#x8FD9;&#x4E9B;&#x524D;&#x7F00;&#x66FF;&#x6362;&#x6210; Miss &#x3001; Mr &#x3001; Mrs &#x3001; Other &#x8FD9;&#x56DB;&#x4E2A;&#x7C7B;&#x522B;&#xFF0C;&#x5E76;&#x7EDF;&#x8BA1;&#x8FD9;&#x56DB;&#x4E2A;&#x7C7B;&#x522B;&#x7684;&#x5E73;&#x5747;&#x5E74;&#x9F84;&#x3002;</p>
<pre><code class="lang-python">data[<span class="hljs-string">&apos;Initial&apos;</span>].replace([<span class="hljs-string">&apos;Mlle&apos;</span>,<span class="hljs-string">&apos;Mme&apos;</span>,<span class="hljs-string">&apos;Ms&apos;</span>,<span class="hljs-string">&apos;Dr&apos;</span>,<span class="hljs-string">&apos;Major&apos;</span>,<span class="hljs-string">&apos;Lady&apos;</span>,<span class="hljs-string">&apos;Countess&apos;</span>,<span class="hljs-string">&apos;Jonkheer&apos;</span>,<span class="hljs-string">&apos;Col&apos;</span>,<span class="hljs-string">&apos;Rev&apos;</span>,<span class="hljs-string">&apos;Capt&apos;</span>,<span class="hljs-string">&apos;Sir&apos;</span>,<span class="hljs-string">&apos;Don&apos;</span>],[<span class="hljs-string">&apos;Miss&apos;</span>,<span class="hljs-string">&apos;Miss&apos;</span>,<span class="hljs-string">&apos;Miss&apos;</span>,<span class="hljs-string">&apos;Mr&apos;</span>,<span class="hljs-string">&apos;Mr&apos;</span>,<span class="hljs-string">&apos;Mrs&apos;</span>,<span class="hljs-string">&apos;Mrs&apos;</span>,<span class="hljs-string">&apos;Other&apos;</span>,<span class="hljs-string">&apos;Other&apos;</span>,<span class="hljs-string">&apos;Other&apos;</span>,<span class="hljs-string">&apos;Mr&apos;</span>,<span class="hljs-string">&apos;Mr&apos;</span>,<span class="hljs-string">&apos;Mr&apos;</span>],inplace=<span class="hljs-keyword">True</span>)
data.groupby(<span class="hljs-string">&apos;Initial&apos;</span>)[<span class="hljs-string">&apos;Age&apos;</span>].mean()
</code></pre>
<p><img src="../img/41.jpg" alt=""></p>
<p>&#x63A5;&#x7740;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x524D;&#x7F00;&#x6765;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x7684;&#x5E74;&#x9F84;&#x3002;</p>
<pre><code class="lang-python">data.loc[(data.Age.isnull())&amp;(data.Initial==<span class="hljs-string">&apos;Mr&apos;</span>),<span class="hljs-string">&apos;Age&apos;</span>]=<span class="hljs-number">33</span>
data.loc[(data.Age.isnull())&amp;(data.Initial==<span class="hljs-string">&apos;Mrs&apos;</span>),<span class="hljs-string">&apos;Age&apos;</span>]=<span class="hljs-number">36</span>
data.loc[(data.Age.isnull())&amp;(data.Initial==<span class="hljs-string">&apos;Miss&apos;</span>),<span class="hljs-string">&apos;Age&apos;</span>]=<span class="hljs-number">22</span>
data.loc[(data.Age.isnull())&amp;(data.Initial==<span class="hljs-string">&apos;Other&apos;</span>),<span class="hljs-string">&apos;Age&apos;</span>]=<span class="hljs-number">46</span>
</code></pre>
<p>&#x586B;&#x5145;&#x5B8C;&#x7F3A;&#x5931;&#x503C;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x5C1D;&#x8BD5;&#x53EF;&#x89C6;&#x5316;&#x4E00;&#x4E0B;&#x3002;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">20</span>,<span class="hljs-number">10</span>))
data[data[<span class="hljs-string">&apos;Survived&apos;</span>]==<span class="hljs-number">0</span>].Age.plot.hist(ax=ax[<span class="hljs-number">0</span>],bins=<span class="hljs-number">20</span>,edgecolor=<span class="hljs-string">&apos;black&apos;</span>,color=<span class="hljs-string">&apos;red&apos;</span>)
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Survived= 0&apos;</span>)
x1=list(range(<span class="hljs-number">0</span>,<span class="hljs-number">85</span>,<span class="hljs-number">5</span>))
ax[<span class="hljs-number">0</span>].set_xticks(x1)
data[data[<span class="hljs-string">&apos;Survived&apos;</span>]==<span class="hljs-number">1</span>].Age.plot.hist(ax=ax[<span class="hljs-number">1</span>],color=<span class="hljs-string">&apos;green&apos;</span>,bins=<span class="hljs-number">20</span>,edgecolor=<span class="hljs-string">&apos;black&apos;</span>)
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Survived= 1&apos;</span>)
x2=list(range(<span class="hljs-number">0</span>,<span class="hljs-number">85</span>,<span class="hljs-number">5</span>))
ax[<span class="hljs-number">1</span>].set_xticks(x2)
plt.show()
</code></pre>
<p><img src="../img/42.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA; 5 &#x5C81;&#x4EE5;&#x4E0B;&#x7684;&#x5C0F;&#x5C41;&#x5B69;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6BD4;&#x8F83;&#x9AD8;&#xFF0C;80 &#x5C81;&#x7684;&#x8001;&#x4EBA;&#x6D3B;&#x4E0B;&#x6765;&#x4E86;&#x3002;</p>
<pre><code class="lang-python">sns.factorplot(<span class="hljs-string">&apos;Pclass&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,col=<span class="hljs-string">&apos;Initial&apos;</span>,data=data)
plt.show()
</code></pre>
<p><img src="../img/43.jpg" alt=""></p>
<p>&#x55EF;&#xFF0C;&#x5973;&#x6027;&#x548C;&#x5C0F;&#x5B69;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6BD4;&#x8F83;&#x9AD8;&#x3002;</p>
<h2 id="&#x767B;&#x8239;&#x53E3;&#x5CB8;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x767B;&#x8239;&#x53E3;&#x5CB8;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x5148;&#x628A;&#x53E3;&#x5CB8;&#x548C;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;&#x753B;&#x51FA;&#x6765;&#x3002;</p>
<pre><code class="lang-python">sns.factorplot(<span class="hljs-string">&apos;Embarked&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,data=data)
fig=plt.gcf()
fig.set_size_inches(<span class="hljs-number">5</span>,<span class="hljs-number">3</span>)
plt.show()
</code></pre>
<p><img src="../img/44.jpg" alt=""></p>
<p>&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x4ECE; C &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x9AD8;&#xFF0C;&#x6700;&#x4F4E;&#x7684;&#x662F; S &#x53F7;&#x53E3;&#x5CB8;&#x3002;&#x55EF;&#xFF0C;&#x597D;&#x50CF;&#x5E76;&#x6CA1;&#x6709;&#x4EC0;&#x4E48;&#x7EBF;&#x7D22;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x518D;&#x6DF1;&#x5165;&#x4E00;&#x70B9;&#x3002;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">2</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">20</span>,<span class="hljs-number">15</span>))
sns.countplot(<span class="hljs-string">&apos;Embarked&apos;</span>,data=data,ax=ax[<span class="hljs-number">0</span>,<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>,<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;No. Of Passengers Boarded&apos;</span>)
sns.countplot(<span class="hljs-string">&apos;Embarked&apos;</span>,hue=<span class="hljs-string">&apos;Sex&apos;</span>,data=data,ax=ax[<span class="hljs-number">0</span>,<span class="hljs-number">1</span>])
ax[<span class="hljs-number">0</span>,<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Male-Female Split for Embarked&apos;</span>)
sns.countplot(<span class="hljs-string">&apos;Embarked&apos;</span>,hue=<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>,<span class="hljs-number">0</span>])
ax[<span class="hljs-number">1</span>,<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Embarked vs Survived&apos;</span>)
sns.countplot(<span class="hljs-string">&apos;Embarked&apos;</span>,hue=<span class="hljs-string">&apos;Pclass&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>,<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>,<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Embarked vs Pclass&apos;</span>)
plt.subplots_adjust(wspace=<span class="hljs-number">0.2</span>,hspace=<span class="hljs-number">0.5</span>)
plt.show()
</code></pre>
<p><img src="../img/45.jpg" alt=""></p>
<p>&#x73B0;&#x5728;&#x80FD;&#x770B;&#x51FA;&#x5F88;&#x591A;&#x4FE1;&#x606F;&#x4E86;&#xFF1A;</p>
<ul>
<li>&#x4E0A;&#x8239;&#x4EBA;&#x6570;&#x6700;&#x591A;&#x7684;&#x53E3;&#x5CB8;&#x662F; S &#x53F7;&#x53E3;&#x5CB8;&#xFF0C;&#x800C;&#x4E14;&#x5728; S &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x4EBA;&#x5927;&#x591A;&#x6570;&#x90FD;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x3002;</li>
<li>C &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x9AD8;&#xFF0C;&#x53EF;&#x80FD;&#x5927;&#x90E8;&#x5206; C &#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x4EBA;&#x662F;&#x4E00;&#x7B49;&#x8231;&#x548C;&#x4E8C;&#x7B49;&#x8231;&#x8239;&#x5BA2;&#x5427;&#x3002;</li>
<li>&#x867D;&#x7136;&#x6709;&#x5F88;&#x591A;&#x4E00;&#x7B49;&#x8231;&#x7684;&#x571F;&#x8C6A;&#x4EEC;&#x57FA;&#x672C;&#x4E0A;&#x90FD;&#x662F;&#x5728; S &#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#xFF0C;&#x4F46;&#x662F; S &#x53E3;&#x5CB8;&#x7684;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x4F4E;&#x3002;&#x8FD9;&#x662F;&#x56E0;&#x4E3A; S &#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x4EBA;&#x4E2D;&#x6709;&#x5F88;&#x591A;&#x90FD;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x3002;</li>
<li>Q &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x4EBA;&#x4E2D;&#x6709; 90% &#x591A;&#x90FD;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x3002;</li>
</ul>
<pre><code class="lang-python">sns.factorplot(<span class="hljs-string">&apos;Pclass&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,hue=<span class="hljs-string">&apos;Sex&apos;</span>,col=<span class="hljs-string">&apos;Embarked&apos;</span>,data=data)
plt.show()
</code></pre>
<p><img src="../img/46.jpg" alt=""></p>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF1A;</p>
<ul>
<li>&#x4E00;&#x7B49;&#x8231;&#x548C;&#x4E8C;&#x7B49;&#x8231;&#x7684;&#x5973;&#x6027;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x51E0;&#x4E4E;&#x4E3A; 100%&#xFF0C; &#x8FD9;&#x4E0E;&#x5973;&#x6027;&#x662F;&#x4E00;&#x7B49;&#x8231;&#x8FD8;&#x662F;&#x4E8C;&#x7B49;&#x8231;&#x6CA1;&#x5565;&#x5173;&#x7CFB;&#x3002;</li>
<li>S &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x5E76;&#x4E14;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#xFF0C;&#x4E0D;&#x7BA1;&#x662F;&#x7537;&#x7684;&#x8FD8;&#x662F;&#x5973;&#x7684;&#xFF0C;&#x751F;&#x8FD8;&#x7387;&#x90FD;&#x5F88;&#x4F4E;&#x3002;&#x91D1;&#x94B1;&#x51B3;&#x5B9A;&#x547D;&#x8FD0;&#x3002;&#x3002;&#x3002;</li>
<li>Q &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x7537;&#x6027;&#x51E0;&#x4E4E;&#x56E2;&#x706D;&#xFF0C;&#x56E0;&#x4E3A;Q &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x8239;&#x7684;&#x57FA;&#x672C;&#x4E0A;&#x90FD;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x8239;&#x5BA2;&#x3002;</li>
</ul>
<h2 id="&#x586B;&#x5145;&#x7F3A;&#x5931;&#x53E3;&#x5CB8;">&#x586B;&#x5145;&#x7F3A;&#x5931;&#x53E3;&#x5CB8;</h2>
<p>&#x7531;&#x4E8E;&#x5927;&#x591A;&#x6570;&#x4EBA;&#x90FD;&#x662F;&#x4ECE; S &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x7684;&#x8239;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5047;&#x8BBE;&#x7531;&#x4E8E;&#x4EBA;&#x591A;&#xFF0C;&#x6240;&#x4EE5;&#x5728; S &#x53E3;&#x5CB8;&#x767B;&#x8BB0;&#x4FE1;&#x606F;&#x65F6;&#x6F0F;&#x4E86;&#x51E0;&#x4F4D;&#x8239;&#x5BA2;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x59A8;&#x7528; S &#x53F7;&#x53E3;&#x5CB8;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x503C;&#x3002;</p>
<pre><code class="lang-python">data[<span class="hljs-string">&apos;Embarked&apos;</span>].fillna(<span class="hljs-string">&apos;S&apos;</span>,inplace=<span class="hljs-keyword">True</span>)
</code></pre>
<h2 id="&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x7684;&#x6570;&#x91CF;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x7684;&#x6570;&#x91CF;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">20</span>,<span class="hljs-number">8</span>))
sns.barplot(<span class="hljs-string">&apos;SibSp&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;SibSp vs Survived&apos;</span>)
sns.factorplot(<span class="hljs-string">&apos;SibSp&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;SibSp vs Survived&apos;</span>)
plt.close(<span class="hljs-number">2</span>)
plt.show()
</code></pre>
<p><img src="../img/47.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x5982;&#x679C;&#x4E00;&#x4F4D;&#x8239;&#x5BA2;&#x662F;&#x5355;&#x72EC;&#x4E00;&#x4E2A;&#x4EBA;&#x4E0A;&#x8239;&#x65C5;&#x6E38;&#xFF0C;&#x6CA1;&#x6709;&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x800C;&#x4E14;&#x662F;&#x5355;&#x8EAB;&#xFF0C;&#x90A3;&#x4E48;&#x4ED6;&#x6709;&#x5927;&#x7EA6; 34% &#x7684;&#x751F;&#x8FD8;&#x7387;&#xFF0C;&#x751F;&#x8FD8;&#x7387;&#x6BD4;&#x8F83;&#x4F4E;&#x3002;&#x5982;&#x679C;&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x7684;&#x6570;&#x91CF;&#x53D8;&#x591A;&#xFF0C;&#x90A3;&#x4E48;&#x751F;&#x8FD8;&#x7387;&#x8FD8;&#x662F;&#x5448;&#x4E0B;&#x964D;&#x8D8B;&#x52BF;&#x7684;&#x3002;&#x8FD9;&#x5176;&#x5B9E;&#x633A;&#x5408;&#x7406;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x5982;&#x679C;&#x662F;&#x4E00;&#x4E2A;&#x5BB6;&#x5EAD;&#x5728;&#x8239;&#x4E0A;&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x8BBE;&#x6CD5;&#x6551;&#x4ED6;&#x4EEC;&#x800C;&#x4E0D;&#x662F;&#x6551;&#x81EA;&#x5DF1;&#xFF0C;&#x8FD9;&#x6837;&#x4E00;&#x6765;&#x53EF;&#x80FD;&#x8C01;&#x90FD;&#x6551;&#x4E0D;&#x4E86;&#x3002;</p>
<h2 id="&#x7236;&#x6BCD;&#x7684;&#x6570;&#x91CF;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x7236;&#x6BCD;&#x7684;&#x6570;&#x91CF;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,figsize=(<span class="hljs-number">20</span>,<span class="hljs-number">8</span>))
sns.barplot(<span class="hljs-string">&apos;Parch&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Parch vs Survived&apos;</span>)
sns.factorplot(<span class="hljs-string">&apos;Parch&apos;</span>,<span class="hljs-string">&apos;Survived&apos;</span>,data=data,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Parch vs Survived&apos;</span>)
plt.close(<span class="hljs-number">2</span>)
plt.show()
</code></pre>
<p><img src="../img/48.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E0A;&#x770B;&#x4F1A;&#x53D1;&#x73B0;&#x7ED3;&#x679C;&#x548C;&#x4E0A;&#x9762;&#x7684;&#x6BD4;&#x8F83;&#x76F8;&#x4F3C;&#xFF0C;&#x7236;&#x6BCD;&#x5728;&#x8239;&#x4E0A;&#x7684;&#x8239;&#x5BA2;&#x6709;&#x66F4;&#x5927;&#x7684;&#x751F;&#x8FD8;&#x673A;&#x4F1A;&#x3002;&#x800C;&#x4E14;&#x5BF9;&#x4E8E;&#x90A3;&#x4E9B;&#x5728;&#x8239;&#x4E0A;&#x6709; 1-3 &#x4E2A;&#x7236;&#x6BCD;&#x7684;&#x4EBA;&#x6765;&#x8BF4;&#xFF0C;&#x751F;&#x8FD8;&#x7387;&#x8FD8;&#x662F;&#x6BD4;&#x8F83;&#x9AD8;&#x7684;&#x3002;</p>
<h2 id="&#x82B1;&#x8D39;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;">&#x82B1;&#x8D39;&#x4E0E;&#x751F;&#x8FD8;&#x7387;&#x7684;&#x5173;&#x7CFB;</h2>
<p>&#x9996;&#x5148;&#xFF0C;&#x5148;&#x770B;&#x4E00;&#x4E0B;&#x82B1;&#x8D39;&#x7684;&#x6700;&#x503C;&#x548C;&#x5747;&#x503C;&#x3002;</p>
<pre><code class="lang-python">print(<span class="hljs-string">&apos;Highest Fare was:&apos;</span>,data[<span class="hljs-string">&apos;Fare&apos;</span>].max())
print(<span class="hljs-string">&apos;Lowest Fare was:&apos;</span>,data[<span class="hljs-string">&apos;Fare&apos;</span>].min())
print(<span class="hljs-string">&apos;Average Fare was:&apos;</span>,data[<span class="hljs-string">&apos;Fare&apos;</span>].mean())
</code></pre>
<p><img src="../img/49.jpg" alt=""></p>
<p>&#x60CA;&#x5947;&#x7684;&#x53D1;&#x73B0;&#xFF0C;&#x5C45;&#x7136;&#x6709;&#x4EBA;&#x53EF;&#x4EE5;&#x4EAB;&#x53D7;&#x514D;&#x8D39;&#x8C6A;&#x534E;&#x90AE;&#x8F6E;&#xFF01;&#xFF01;&#xFF01;&#xFF01;</p>
<pre><code class="lang-python">f,ax=plt.subplots(<span class="hljs-number">1</span>,<span class="hljs-number">3</span>,figsize=(<span class="hljs-number">20</span>,<span class="hljs-number">8</span>))
sns.distplot(data[data[<span class="hljs-string">&apos;Pclass&apos;</span>]==<span class="hljs-number">1</span>].Fare,ax=ax[<span class="hljs-number">0</span>])
ax[<span class="hljs-number">0</span>].set_title(<span class="hljs-string">&apos;Fares in Pclass 1&apos;</span>)
sns.distplot(data[data[<span class="hljs-string">&apos;Pclass&apos;</span>]==<span class="hljs-number">2</span>].Fare,ax=ax[<span class="hljs-number">1</span>])
ax[<span class="hljs-number">1</span>].set_title(<span class="hljs-string">&apos;Fares in Pclass 2&apos;</span>)
sns.distplot(data[data[<span class="hljs-string">&apos;Pclass&apos;</span>]==<span class="hljs-number">3</span>].Fare,ax=ax[<span class="hljs-number">2</span>])
ax[<span class="hljs-number">2</span>].set_title(<span class="hljs-string">&apos;Fares in Pclass 3&apos;</span>)
plt.show()
</code></pre>
<p><img src="../img/50.jpg" alt=""></p>
<p>&#x4ECE;&#x56FE;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x5E73;&#x5747;&#x82B1;&#x8D39;&#x5176;&#x5B9E;&#x662F;&#x4E8C;&#x7B49;&#x8231;&#x7684;&#x666E;&#x904D;&#x6D88;&#x8D39;&#x6C34;&#x5E73;&#xFF0C;&#x4F46;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x4EBA;&#x6570;&#x662F;&#x6700;&#x591A;&#x7684;&#xFF0C;&#x800C;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x4EBA;&#x7FA4;&#x4E2D;&#x82B1;&#x8D39;&#x4EBA;&#x6570;&#x6700;&#x591A;&#x7684;&#x662F; 10 &#x5DE6;&#x53F3;&#xFF0C;&#x56E0;&#x6B64;&#x5E73;&#x5747; 32 &#x7684;&#x82B1;&#x8D39;&#x662F;&#x88AB;&#x6709;&#x94B1;&#x7684;&#x5927;&#x4F6C;&#x7ED9;&#x63D0;&#x4E0A;&#x53BB;&#x7684;&#x3002;</p>
<h2 id="&#x7B80;&#x5355;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;">&#x7B80;&#x5355;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;</h2>
<p>&#x770B;&#x4E86;&#x8FD9;&#x4E48;&#x591A;&#x7279;&#x5F81;&#x5BF9;&#x4E8E;&#x751F;&#x8FD8;&#x7684;&#x5F71;&#x54CD;&#xFF0C;&#x53EF;&#x80FD;&#x6709;&#x70B9;&#x61F5;&#xFF0C;&#x4E0D;&#x59A8;&#x5148;&#x7B80;&#x5355;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;&#x6839;&#x636E;&#x53EF;&#x89C6;&#x5316;&#x7ED3;&#x679C;&#x6240;&#x83B7;&#x5F97;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
<ul>
<li>&#x6027;&#x522B;&#xFF1A;&#x5973;&#x6027;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x9AD8;</li>
<li>&#x8239;&#x8231;&#x7B49;&#x7EA7;&#xFF1A;&#x8D8A;&#x6709;&#x94B1;&#x8D8A;&#x5BB9;&#x6613;&#x6D3B;&#x4E0B;&#x6765;&#xFF0C;&#x5934;&#x7B49;&#x8231;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x9AD8;&#xFF0C;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6700;&#x4F4E;&#x3002;</li>
<li>&#x5E74;&#x9F84;&#xFF1A;10 &#x5C81;&#x4EE5;&#x4E0B;&#x7684;&#x5C0F;&#x670B;&#x53CB;&#x7684;&#x5B58;&#x6D3B;&#x7387;&#x6BD4;&#x8F83;&#x9AD8;&#xFF0C;15-35 &#x5C81;&#x7684;&#x5E74;&#x8F7B;&#x4EBA;&#x5B58;&#x6D3B;&#x7387;&#x4F4E;&#x3002;&#x53EF;&#x80FD;&#x5E74;&#x8F7B;&#x4EBA;&#x5C31;&#x662F;&#x70AE;&#x7070;&#x5427;&#x3002;</li>
<li>&#x53E3;&#x5CB8;&#xFF1A;&#x5373;&#x4F7F;&#x5927;&#x591A;&#x6570;&#x4E00;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x5728; S &#x53F7;&#x53E3;&#x5CB8;&#x4E0A;&#x7684;&#x8239;&#xFF0C; &#x4F46;&#x751F;&#x8FD8;&#x7387;&#x4E0D;&#x662F;&#x6700;&#x9AD8;&#x7684;&#x3002; Q &#x53F7;&#x53E3;&#x5CB8;&#x7684;&#x57FA;&#x672C;&#x4E0A;&#x662F;&#x4E09;&#x7B49;&#x8231;&#x7684;&#x8239;&#x5BA2;&#x3002;</li>
<li>&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#x7236;&#x6BCD;&#x7231;&#x4EBA;&#x6570;&#x91CF;&#xFF1A;&#x6709; 1-2 &#x4E2A;&#x5144;&#x5F1F;&#x59D0;&#x59B9;&#xFF0C;&#x914D;&#x5076;&#x5728;&#x8239;&#x4E0A;&#xFF0C;&#x6216; 1-3 &#x4E2A;&#x7236;&#x6BCD;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6BD4;&#x8F83;&#x9AD8;&#xFF0C;&#x72EC;&#x81EA;&#x4E00;&#x4EBA;&#x6216;&#x8005;&#x4E00;&#x4E2A;&#x5927;&#x5BB6;&#x5EAD;&#x90FD;&#x5728;&#x8239;&#x4E0A;&#x7684;&#x751F;&#x8FD8;&#x7387;&#x6BD4;&#x8F83;&#x4F4E;&#x3002;</li>
</ul>
<h2 id="&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x7684;&#x76F8;&#x5173;&#x6027;&#x7CFB;&#x6570;">&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x7684;&#x76F8;&#x5173;&#x6027;&#x7CFB;&#x6570;</h2>
<p>&#x76F8;&#x5173;&#x6027;&#x5206;&#x4E3A;&#x6B63;&#x76F8;&#x5173;&#x4E0E;&#x8D1F;&#x76F8;&#x5173;&#xFF0C;&#x6B63;&#x76F8;&#x5173;&#x6307;&#x7684;&#x662F;&#xFF1A;&#x5982;&#x679C;&#x7279;&#x5F81; A &#x7684;&#x6570;&#x503C;&#x53D8;&#x5927;&#x4F1A;&#x5BFC;&#x81F4;&#x7279;&#x5F81; B &#x7684;&#x6570;&#x503C;&#x53D8;&#x5927;&#xFF1B;&#x8D1F;&#x76F8;&#x5173;&#x6307;&#x7684;&#x662F;&#xFF1A;&#x5982;&#x679C;&#x7279;&#x5F81; A &#x7684;&#x6570;&#x503C;&#x53D8;&#x5C0F;&#x4F1A;&#x5BFC;&#x81F4;&#x7279;&#x5F81; B &#x7684;&#x6570;&#x503C;&#x53D8;&#x5927;&#x3002;&#x901A;&#x5E38;&#x4F7F;&#x7528; [-1, 1] &#x7684;&#x6570;&#x503C;&#x6765;&#x8868;&#x793A;&#x4E24;&#x4E2A;&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x7684;&#x76F8;&#x5173;&#x6027;&#xFF0C;&#x8FD9;&#x4E2A;&#x503C;&#x79F0;&#x4E3A;<strong>&#x76F8;&#x5173;&#x6027;&#x7CFB;&#x6570;</strong>&#x3002;&#x82E5;&#x8BE5;&#x7CFB;&#x6570;&#x4E3A; 1 &#x90A3;&#x4E48;&#x8868;&#x793A;&#x4E24;&#x4E2A;&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x5B8C;&#x5168;&#x6B63;&#x76F8;&#x5173;&#xFF0C;&#x82E5;&#x4E3A; -1 &#x5219;&#x8868;&#x793A;&#x5B8C;&#x5168;&#x8D1F;&#x76F8;&#x5173;&#xFF0C;&#x82E5;&#x4E3A; 0 &#x5219;&#x8868;&#x793A;&#x4E24;&#x4E2A;&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x6CA1;&#x6709;&#x76F8;&#x5173;&#x6027;(&#x7EBF;&#x6027;&#x7684;)&#x3002;</p>
<p>&#x5982;&#x679C;&#x73B0;&#x5728;&#x4E24;&#x4E2A;&#x7279;&#x5F81;&#x9AD8;&#x5EA6;&#x76F8;&#x5173;&#x6216;&#x8005;&#x5B8C;&#x5168;&#x76F8;&#x5173;&#xFF0C;&#x8FD9;&#x5C31;&#x610F;&#x5473;&#x7740;&#x8FD9;&#x4E24;&#x4E2A;&#x7279;&#x5F81;&#x90FD;&#x5305;&#x542B;&#x9AD8;&#x5EA6;&#x76F8;&#x4F3C;&#x7684;&#x4FE1;&#x606F;&#xFF0C;&#x5E76;&#x4E14;&#x4FE1;&#x606F;&#x7684;&#x5DEE;&#x5F02;&#x975E;&#x5E38;&#x5C0F;&#xFF0C;&#x6240;&#x4EE5;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x7279;&#x5F81;&#x662F;&#x591A;&#x4F59;&#x7684;&#x3002;&#x5728;&#x6784;&#x5EFA;&#x6A21;&#x578B;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x5E94;&#x8BE5;&#x5C3D;&#x91CF;&#x6D88;&#x9664;&#x8FD9;&#x79CD;&#x591A;&#x4F59;&#x7684;&#x7279;&#x5F81;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x6837;&#x80FD;&#x51CF;&#x5C11;&#x8BAD;&#x7EC3;&#x7684;&#x65F6;&#x95F4;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x67D0;&#x79CD;&#x7A0B;&#x5EA6;&#x4E0A;&#x7F13;&#x89E3;&#x8FC7;&#x62DF;&#x5408;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#x63A5;&#x4E0B;&#x6765;&#x7528;&#x70ED;&#x529B;&#x56FE;&#x5BF9;&#x76F8;&#x5173;&#x6027;&#x7CFB;&#x6570;&#x8FDB;&#x884C;&#x53EF;&#x89C6;&#x5316;&#x3002;</p>
<pre><code class="lang-python">sns.heatmap(data.corr(),annot=<span class="hljs-keyword">True</span>,cmap=<span class="hljs-string">&apos;RdYlGn&apos;</span>,linewidths=<span class="hljs-number">0.2</span>) <span class="hljs-comment">#data.corr()--&gt;correlation matrix</span>
fig=plt.gcf()
fig.set_size_inches(<span class="hljs-number">10</span>,<span class="hljs-number">8</span>)
plt.show()
</code></pre>
<p><img src="../img/51.jpg" alt=""></p>
<p>&#x4ECE;&#x70ED;&#x529B;&#x56FE;&#x4E0A;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x8FD9;&#x4E9B;&#x7279;&#x5F81;&#x4E4B;&#x95F4;&#x6CA1;&#x6709;&#x592A;&#x5927;&#x7684;&#x76F8;&#x5173;&#x6027;&#xFF0C;&#x6700;&#x9AD8;&#x7684;&#x4E5F;&#x5C31; SibSp&#x4E0E;Parch&#xFF0C;&#x503C;&#x4E3A; 0.41 &#x3002;</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="introduction.html" class="navigation navigation-prev " aria-label="Previous page: 简介">
<i class="fa fa-angle-left"></i>
</a>
<a href="feature engerning.html" class="navigation navigation-next " aria-label="Next page: 特征工程">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
5 years ago
gitbook.page.hasChanged({"page":{"title":"探索性数据分析(EDA)","level":"1.6.1.2","depth":3,"next":{"title":"特征工程","level":"1.6.1.3","depth":3,"path":"titanic/feature engerning.md","ref":"./titanic/feature engerning.md","articles":[]},"previous":{"title":"简介","level":"1.6.1.1","depth":3,"path":"titanic/introduction.md","ref":"./titanic/introduction.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["katex"],"pluginsConfig":{"katex":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"titanic/EDA.md","mtime":"2019-07-05T02:10:48.992Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-07-06T07:31:21.537Z"},"basePath":"..","book":{"language":""}});
5 years ago
});
</script>
</div>
<script src="../gitbook/gitbook.js"></script>
<script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>