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

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'
主站蜘蛛池模板: 兴山县| 天长市| 北川| 兴山县| 嘉黎县| 曲靖市| 大渡口区| 页游| 盐池县| 大港区| 永宁县| 临武县| 六安市| 阿鲁科尔沁旗| 苍南县| 丰县| 奎屯市| 新野县| 扎赉特旗| 英超| 方山县| 泸水县| 蓬安县| 读书| 中牟县| 山阳县| 龙井市| 宾川县| 宿迁市| 达州市| 隆化县| 建昌县| 禹城市| 获嘉县| 台东市| 湘阴县| 西青区| 绥芬河市| 隆安县| 蓬溪县| 河池市|