错误:

        TypeError: astype() got an unexpected keyword argument 'categories'        

或者:

        TypeError: __init__() got an unexpected keyword argument 'indices'

错误分析:

类型错误:得到意外的关键字参数“categories”

解决方法:

先尝试把多余的参数去掉,如果不行就升级函数包(版本有关)


其他说明:

astype()方法通常用于将Pandas对象转换为指定的dtype.astype()函数

DataFrame.astype(dtype, copy=True, errors='raise', **kwargs)

参数:

dtype : 数据类型或列名称 - >数据类型,使用numpy.dtype或Python类型,将整个pandas对象强制转换为相同的类型。或者,使用{col:dtype,...},其中col是列标签,dtype是numpy.dtype或Python类型,用于将一个或多个DataFrame列转换为特定于列的类型。

copy : bool,默认为True。返回副本时copy=True(设置copy=False为更改值时要非常小心,然后可能会传播到其他pandas对象)。

errors : {‘raise’, ‘ignore’},默认‘raise’控制提供dtype的无效数据的异常。

raise :允许引发异常

ignore:抑制异常。出错时返回原始对象版本0.20.0中的新功能。

kwargs : 传递给构造函数的关键字参数。返回:casted: 与调用者类型相同

python报错 unexpected keyword argument ‘categories‘相关推荐

  1. python出错 unexpected keyword argument 'categories'

    python出错 unexpected keyword argument 'categories' 解决办法 首先卸载scikit-learn 下载scikit-learn 新版 安装scikit-l ...

  2. python 报错:positional argument follows keyword argument

    SyntaxError: positional argument follows keyword argument 语法错误:位置参数跟在关键字参数后面 错误示例 def sub(a, b):retu ...

  3. Celery 启动报错 can_read() got an unexpected keyword argument timeout

    问题: Celery 启动报错 can_read() got an unexpected keyword argument timeout 方案:更改redis版本和celery版本,我使用下面的ce ...

  4. 安装报错:TypeError: _classify_installed_files() got an unexpected keyword argument ‘cmake_install_dir‘

    服务器内安装opencv-python,压缩包解压,python setup.py install,出现报错. Traceback (most recent call last):File " ...

  5. 使用scrapy报错:attrs() got an unexpected keyword argument 'eq'解决办法

    使用scrapy的时候报错attrs() got an unexpected keyword argument 'eq',在百度和bing上面找了一圈没找到解决方法,最后在谷歌上找到了,出现这个问题的 ...

  6. 启动django报错:TypeError: __init__() got an unexpected keyword argument ‘providing_args‘

    问题一:django跨域 现象: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present ...

  7. 【python debug】could not convert string to float: ‘File‘ got an unexpected keyword argument

    python debug过程中碰到的问题随手记录 报错1:ValueError: could not convert string to float: 'File' 在网上没有搜到直接匹配的答案 分析 ...

  8. flask_sqlalchemy连接Mysql报TypeError: create_engine() got an unexpected keyword argument 'encoding'解决办法

    最近在使用flask_sqlalchemy连接mysql,但是遇到一个很奇葩的问题,代码如下: #-*-coding:utf-8 -*-from flask_sqlalchemy import SQL ...

  9. 成功解决python\ops\seq2seq.py TypeError: ms_error() got an unexpected keyword argument 'logits'

    成功解决python\ops\seq2seq.py  TypeError: ms_error() got an unexpected keyword argument 'logits' 目录 解决问题 ...

  10. 成功解决python\ops\seq2seq.py TypeError: ms_error() got an unexpected keyword argument 'labels'

    成功解决python\ops\seq2seq.py TypeError: ms_error() got an unexpected keyword argument 'labels' 目录 解决问题 ...

最新文章

  1. java.lang.NoSuchMethodError: No virtual method placeholder(I)Lcom/bumptech/
  2. 推荐系统+覆盖率(coverage)
  3. MySQL中只会count(),sum()?累加运算没听过?
  4. python视频教程从入门到精通全集-零基础小白python从入门到精通视频(全60集)...
  5. xmake 新站发布:xmake.io
  6. python中英文半角还是全角_Python3全角转半角的方法
  7. 华为nova 7 se鸿蒙,荣耀v40和华为Nova7Pro哪个好-参数对比-更值得入手
  8. 使用electron-vue创建项目卡顿的问题
  9. MySQL8怎么设置时区为东八区_mysql时区设置为东八区
  10. linux命令mov,汇编指令_Y-linuz-linux-w_新浪博客
  11. Fiddler操作技巧
  12. 有序表的最小和(element)
  13. linux下抓取网页快照
  14. 2011戴尔计算机配置,机型与配置(一)
  15. Tesseract OCR 语言包下载
  16. 解决CSDN上传资源出现报错:“该资源已存在,请重新上传”
  17. xml文件中空格输入
  18. 日常开发用到的谷歌浏览器插件
  19. 超感猎杀/超感八人组第一季至二季/全集Sense8迅雷下载
  20. C++虚函数实现机制

热门文章

  1. 苹果手机上怎么打开html,苹果手机信息怎么打开浏览器
  2. 高级编程语言分类_高级编程语言的分类
  3. JS indexOf 用法
  4. elememt ui 组件 dialog使用备忘
  5. 现在证券公司内部各部门详解
  6. 2021年10月国产数据库大事记-墨天轮
  7. 北京大学公开课-影片赏析
  8. 财务部门如何用OKR管理法?看最新OKR模板
  9. 对接微信公众(开放)平台,获取微信用户信息,实现第三方登录
  10. 我的2018OKR年终回顾与2019OKR初步规划