成功解决TypeError: data type ‘category‘ not understood

简介: 成功解决TypeError: data type ‘category‘ not understood


目录

解决问题

解决思路

解决方法


解决问题

TypeError: data type 'category' not understood

解决思路

类型错误:不理解数据类型“类别”

解决方法

在if判断的时候,除了内容相同之外,一定要观察两边的对象到底是不是类型也相同,比如我在进行以下判断的时候,内容相同,但是两边的类型却不相同,经常输出查看,左边的却是类型,所以当然,会报错!

需要将

1. if df[col].dtypes=='category'
2. 改为
3. if str(df[col].dtypes)=='category':


相关文章
|
2月前
|
JavaScript 前端开发
完美解决 报错 Vue Invalid prop: type check failed for prop “min“. Expected Number with value 1,
完美解决 报错 Vue Invalid prop: type check failed for prop “min“. Expected Number with value 1,
85 1
|
2月前
|
iOS开发 MacOS
TypeError: Cannot read property ‘shop‘ of undefined
TypeError: Cannot read property ‘shop‘ of undefined
23 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
Error: Element type is invalid: expected a string (for built-in components) or a class/function
2429 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
|
2月前
Excel上传出错:TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string or an instan
Excel上传出错:TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string or an instan
|
9月前
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
70 0
|
前端开发 JavaScript
前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
1230 0
前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
|
Python
AttributeError: type object ‘Image‘ has no attribute ‘open‘
原因分析:Image调用顺序出错,因为第一行的from PIL import Image与第二行tkinter import *冲突,tkinter中也含有Image类,所以你使用的是tkinter.Image
192 0
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题