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

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'
主站蜘蛛池模板: 如东县| 津市市| 福建省| 佛坪县| 河曲县| 鹰潭市| 驻马店市| 北宁市| 延长县| 绥江县| 铜陵市| 江城| 闽清县| 会昌县| 绍兴市| 琼海市| 太保市| 双柏县| 中宁县| 富民县| 阳山县| 铁岭市| 松原市| 东辽县| 丰宁| 马山县| 通化市| 河池市| 尼木县| 夏河县| 汝南县| 申扎县| 新营市| 习水县| 南涧| 新化县| 乐清市| 四子王旗| 谢通门县| 格尔木市| 阿尔山市|