We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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:
No branches or pull requests
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: