我的y峎u列车由多种成分组成。每种成分都由逗号分隔的不同成分组成。它基本上是一个多类分类问题。我的火车看起来像这样
df['ingredients_str'].head()
0 romaine lettuce,black olives,grape tomatoes
1 plain flour,ground pepper,salt,tomatoes
2 eggs,pepper,salt,mayonaise,cooking oil
3 water,vegetable oil,wheat,salt
4 black pepper,shallots,cornflour,cayenne
Name: ingredients_str, dtype: object
我尝试用sklearn label encoder对分类变量进行编码。在
^{pr2}$如何在labelencoder中转换该列?在
你想在每个单元格中检索标签编码标签的列表。为此,您可以取消标签列的层数,处理每个列,然后将输出数据帧重新压缩为一列。在
相关问题 更多 >
编程相关推荐