牛哥带你学代码 2023-03-30 21:38 采纳率: 100%
浏览 22
已结题

python编译报错


Traceback (most recent call last):
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "F:\pyhcarm\PyCharm 2022.2.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "F:\pyhcarm\PyCharm 2022.2.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Lenovo/Desktop/20230330实验课作业/实验作业/A2140772C0746524CBDBBCA9C0AABCC8.py", line 45, in <module>
    mm_data = mm.fit_transform(data)  # 归一化后的数据
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\utils\_set_output.py", line 142, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\utils\_set_output.py", line 142, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\base.py", line 848, in fit_transform
    return self.fit(X, **fit_params).transform(X)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\preprocessing\_data.py", line 427, in fit
    return self.partial_fit(X, y)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\preprocessing\_data.py", line 466, in partial_fit
    X = self._validate_data(
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\base.py", line 535, in _validate_data
    X = check_array(X, input_name="X", **check_params)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\utils\validation.py", line 877, in check_array
    array = _asarray_with_order(array, order=order, dtype=dtype, xp=xp)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\sklearn\utils\_array_api.py", line 185, in _asarray_with_order
    array = numpy.asarray(array, order=order, dtype=dtype)
  File "C:\Users\Lenovo\PycharmProjects\pythonProject9\venv\lib\site-packages\pandas\core\generic.py", line 2070, in __array__
    return np.asarray(self._values, dtype=dtype)
ValueError: could not convert string to float: 'Sphagnum Moss'

有没有人能告诉我这个报错是什么意思 呀?使用层次聚类分析的时候报的错
谢谢

  • 写回答

2条回答 默认 最新

  • 文盲老顾 WEB应用领新星创作者 2023-03-30 21:46
    关注

    看最后一行,无法将字符串转成浮点类型

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月7日
  • 已采纳回答 3月30日
  • 创建了问题 3月30日

悬赏问题

  • ¥15 类图中关联与聚合的区别
  • ¥15 ENVI高分五号去除云层的方法
  • ¥15 16进制数据如何得到奇偶校验位
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题
  • ¥15 海湾GST-DJ-N500
  • ¥15 氧化掩蔽层与注入条件关系