官术网_书友最值得收藏!

Missing value inputting

This approach is useful when you have categorical data. The intuition behind this approach is that missing values may correlate with other variables, and removing them will result in a loss of information that can affect the model significantly.
For example, if we have a binary variable with two possible values, -1 and 1, we can add another value (0) to indicate a missing value. You can use the following code to replace the null values of the Cabin feature with U0:

# replacing the missing value in cabin variable "U0"
df_titanic_data['Cabin'][df_titanic_data.Cabin.isnull()] = 'U0'
主站蜘蛛池模板: 武川县| 通州市| 石家庄市| 崇左市| 杭锦旗| 闽清县| 永丰县| 平泉县| 安乡县| 磴口县| 中江县| 秀山| 安化县| 乐都县| 宁明县| 嘉峪关市| 华容县| 通渭县| 涪陵区| 八宿县| 濮阳市| 通辽市| 武宣县| 庆安县| 云南省| 五寨县| 镇巴县| 新龙县| 漳浦县| 昌都县| 聂荣县| 砚山县| 澎湖县| 瑞丽市| 涡阳县| 昌江| 黔西| 海晏县| 宣恩县| 达拉特旗| 安吉县|