python-3.x - 当我运行此代码时,出现错误:“TypeError:参数必须是字符串或数字”
问题描述
这是我的代码:
lbl_enc = preprocessing.LabelEncoder()
y = lbl_enc.fit_transform(data.name_of_the_column.values)
“name_of_the_column”列是 str。我该如何解决?
IN : type(data.name_of_the_column.values[1])
OUT: str
解决方案
推荐阅读
- .net - 为什么 PowerShell 中的 ScriptBlock 会延迟输出,直到 ScriptBlock 完成?
- javascript - 我如何将下载链接插入到 image2 中,或者如何将其放入下载按钮中?
- excel - 打开带有变量的工作簿时出现错误 438
- javascript - 如何将 Jasmine 设置添加到“独立”Jasmine 设置(使用 SpecRunner.html 的设置)
- javascript - 如何在部分可滚动的表格上使用 div 滚动?
- ios - 来自 ipad 上 tableViewCell 弹出框的 Sharesheet
- c - C 终端中的颜色 (Windows)
- algorithm - 如果没有 AVX2 指令中的快速聚集和分散,你会怎么做?
- mysql - MySQL - 如果条件不唯一,则丢弃记录
- excel - Excel VBA - 如果在日期范围内,将表格行复制到另一个工作表