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

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'
主站蜘蛛池模板: 平潭县| 大洼县| 汾阳市| 仲巴县| 五常市| 新巴尔虎左旗| 托克逊县| 太谷县| 巴马| 抚宁县| 昌平区| 卢氏县| 报价| 竹北市| 原平市| 湖州市| 威海市| 元氏县| 蓬莱市| 隆尧县| 麻江县| 余庆县| 绥宁县| 龙里县| 集安市| 桐梓县| 宝应县| 兰考县| 平阳县| 苏尼特右旗| 龙海市| 张北县| 增城市| 大理市| 新乐市| 香港 | 达拉特旗| 晋中市| 正蓝旗| 江达县| 盘山县|