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

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'
主站蜘蛛池模板: 民乐县| 凌海市| 蚌埠市| 华安县| 康平县| 武胜县| 涟源市| 鄂伦春自治旗| 庐江县| 治多县| 蓝山县| 滦南县| 中方县| 安塞县| 阳泉市| 南召县| 密山市| 乐平市| 兴业县| 江孜县| 哈巴河县| 遂昌县| 广东省| 宜宾县| 陈巴尔虎旗| 桂平市| 德令哈市| 阳谷县| 阳朔县| 静宁县| 潼南县| 阳江市| 娄底市| 兴安盟| 库尔勒市| 千阳县| 新化县| 乐亭县| 永福县| 东乌| 文山县|