#查看数据集的字段
print(train.columns.values)
#DataFrame及其各列的describe函数可以查看到统计数据
train.describe(include='all')
['PassengerId' 'Survived' 'Pclass' 'Name' 'Sex' 'Age' 'SibSp' 'Parch'
'Ticket' 'Fare' 'Cabin' 'Embarked']
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>PassengerId</th>
<th>Survived</th>
<th>Pclass</th>
<th>Name</th>
<th>Sex</th>
<th>Age</th>
<th>SibSp</th>
<th>Parch</th>
<th>Ticket</th>
<th>Fare</th>
<th>Cabin</th>
<th>Embarked</th>
</tr>
</thead>
<tbody>
<tr>
<th>count</th>
<td>891.000000</td>
<td>891.000000</td>
<td>891.000000</td>
<td>891</td>
<td>891</td>
<td>714.000000</td>
<td>891.000000</td>
<td>891.000000</td>
<td>891</td>
<td>891.000000</td>
<td>204</td>
<td>889</td>
</tr>
<tr>
<th>unique</th>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>891</td>
<td>2</td>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>681</td>
<td>NaN</td>
<td>147</td>
<td>3</td>
</tr>
<tr>
<th>top</th>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>Silverthorne, Mr. Spencer Victor</td>
<td>male</td>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>347082</td>
<td>NaN</td>
<td>B96 B98</td>
<td>S</td>
</tr>
<tr>
<th>freq</th>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>1</td>
<td>577</td>
<td>NaN</td>
<td>NaN</td>
<td>NaN</td>
<td>7</td>
<td>NaN</td>
<td>4</td>
<td>644</td>
</tr>
<tr>
<th>mean</th>
<td>446.000000</td>
<td>0.383838</td>
<td>2.308642</td>
<td>NaN</td>
<td>NaN</td>
<td>29.699118</td>
<td>0.523008</td>
<td>0.381594</td>
<td>NaN</td>
<td>32.204208</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>std</th>
<td>257.353842</td>
<td>0.486592</td>
<td>0.836071</td>
<td>NaN</td>
<td>NaN</td>
<td>14.526497</td>
<td>1.102743</td>
<td>0.806057</td>
<td>NaN</td>
<td>49.693429</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>min</th>
<td>1.000000</td>
<td>0.000000</td>
<td>1.000000</td>
<td>NaN</td>
<td>NaN</td>
<td>0.420000</td>
<td>0.000000</td>
<td>0.000000</td>
<td>NaN</td>
<td>0.000000</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>25%</th>
<td>223.500000</td>
<td>0.000000</td>
<td>2.000000</td>
<td>NaN</td>
<td>NaN</td>
<td>20.125000</td>
<td>0.000000</td>
<td>0.000000</td>
<td>NaN</td>
<td>7.910400</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>50%</th>
<td>446.000000</td>
<td>0.000000</td>
<td>3.000000</td>
<td>NaN</td>
<td>NaN</td>
<td>28.000000</td>
<td>0.000000</td>
<td>0.000000</td>
<td>NaN</td>
<td>14.454200</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>75%</th>
<td>668.500000</td>
<td>1.000000</td>
<td>3.000000</td>
<td>NaN</td>
<td>NaN</td>
<td>38.000000</td>
<td>1.000000</td>
<td>0.000000</td>
<td>NaN</td>
<td>31.000000</td>
<td>NaN</td>
<td>NaN</td>
</tr>
<tr>
<th>max</th>
<td>891.000000</td>
<td>1.000000</td>
<td>3.000000</td>
<td>NaN</td>
<td>NaN</td>
<td>80.000000</td>
<td>8.000000</td>
<td>6.000000</td>
<td>NaN</td>
<td>512.329200</td>
<td>NaN</td>
<td>NaN</td>
</tr>
</tbody>
</table>