-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第二章第一节数据清洗及特征处理 #11
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for循环,numpy.map转换对文本变量进行转换,构造映射时,.nunique()函数里的参数dropna应该是False
for feat in ['Cabin', 'Ticket']:
label_dict = dict(zip(df[feat].unique(), range(df[feat].nunique(dropna=False))))
df[feat + "_labelEncode"] = df[feat].map(label_dict)
不然的话,'Cabin'的C148这里会返回一个NaN值
The text was updated successfully, but these errors were encountered: