![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python报错解决方案
小猪课堂
用最简短的描述,解决你遇到的问题,节约的时间可以用来思考~
展开
-
【Python报错解决方案】TypeError: ‘float‘ object is not callable
最近又开始写代码了,今天学习神经网络的BP时候发现了一个报错并且在网站上看了,大部分的解释都很简单但是有很难懂,但是人家的方法也是可以用的。其实这个错误非常简单,但如果你不注意就或报错并且由于太简单了就很难发现。解决方法:在数与数之间的加减乘除符号不能省略例子报错代码w[1] = w[1]-0.5( t1 * w[7] + t2 * w[8] )*h1*(1.0-h1)*l[1] 这段代码会报错!!!!错误:TypeError: ‘float’ object is not callable原创 2021-01-31 17:57:20 · 9130 阅读 · 1 评论 -
【Python报错解决方案】TypeError: Cannot compare types ‘ndarray(dtype=int64)‘ and ‘int64‘
Python报错解决方案TypeError: Cannot compare types ‘ndarray(dtype=int64)’ and 'int64’不仅报错运行还慢data_replace = data.replace(code_dic)报错内容:解决方法:def replace_(x): #替换函数 return code_dic[x]data.applymap(lambda x: replace_(x))...原创 2020-10-12 17:08:30 · 5284 阅读 · 1 评论 -
【Python报错解决方案】Spyder书写时显示:IndentationError: unexpected indent
·加粗样式1、使用Spyder调用自写类(class)时提示:IndentationError: unexpected indent;2、检验后未发现有任何书写问题,缩进都正常;3、使用notebook时运行正常满足以上3个条件的可以尝试使用我的方法(亲测天坑)解决方法:1、删除所有注释2、将注释缩进以上两种解决方法,推荐使用2吧问题很简单,解决的朋友请点赞----------------分享完毕------------------------Address:北京Date:20200原创 2020-09-29 15:25:24 · 2148 阅读 · 0 评论 -
【Python报错解决方法】:ParserError:Error tokenizing data.C error:Expected x fields in line nnn,saw y.
使用pandas.read_csv(filePath)方法来读取csv文件时,可能会出现这种错误:ParserError: 如:Error tokenizing data.C error:Expected 2 fields in line 407,saw 3.这句话的意思是,在csv文件的第407行数据,期待2个字段,但在第407行实际发现了3个字段。原因:header只有两个字段名,但数据的第407行却出现了3个字段(可能是该行数据包含了逗号,或者确实有三个部分),导致pandas不知道该如何处理原创 2020-09-14 10:21:25 · 23736 阅读 · 1 评论 -
【Python报错解决方案】AttributeError: int object has no attribute log
你很可能看到了这篇文章,但是不是很简洁AttributeError: ‘int’ object has no attribute ‘log’来我们直接点报错代码np.log(dt['good']/dt['bad'])解决方案np.log((dt['good']/dt['bad']).astype('float'))结束~原因就是因为数据格式,之前是这个列是object,要改成basePython比R语言友好些喜欢的壮士请留下你的赞写于:北京2020-06-16...原创 2020-06-17 14:39:01 · 15956 阅读 · 0 评论 -
【python报错解决方案】AttributeError: Series object has no attribute days
报错:AttributeError: ‘Series’ object has no attribute 'days’闲篇:https://stackoverflow.com/questions/61563275/for-loop-gets-attributeerror-series-object-has-no-attribute-days#new-answer刚刚本来想在英文网站上回到一波类似的问题,无奈我没有账号,三年级英语也不好,哈喽半天也不知道写啥问题方法df4['diff']=(pd.原创 2020-06-10 09:13:37 · 11890 阅读 · 0 评论 -
【Python报错解决方案】jupyter notebook代码自动补全,看了很多教程这个最靠谱
jupyter notebook代码自动补全看了很多教程这个最靠谱第一步: 安装nbextensionspip install --user jupyter_contrib_nbextensionsjupyter contrib nbextension install --user如果出错第2行,产生错误:Error executing Jupyter command ‘contrib’: [Errno ‘jupyter-contrib’ not found] 2文件不存在,查看Scrip原创 2020-05-12 14:18:03 · 1459 阅读 · 0 评论 -
【Python报错解决】from PIL import Image突然不能调用了,亲测!问题已解决
重装Pillow之后即可恢复正常在cmd命令行窗口输入:pip uninstall Pillow待卸载成功后再次安装:pip install Pillowfrom PIL import Image即可成功赶快关注我,博主专业扫坑3年,只要时间长没有你猜不到的坑...原创 2020-03-07 20:23:34 · 3978 阅读 · 1 评论 -
【Python报错解决方案】 ValueError Traceback (most recent call last)
错误提示:ValueError Traceback (most recent call last)意思就是:值错误回溯(最近一次调用)这类错误很常见但是首先分析一下错误类型是 ValueError 第一个就要想到value;然后看报错提醒 Traceback (most recent call last)想这类的报错会有很多种情况,一般都是因为修改值后发生了错误第一:去查看你的函数使...原创 2020-02-25 23:59:39 · 53806 阅读 · 1 评论 -
【Python报错解决方案】亲测有效:Message: 'chromedriver.exe' executable needs to be in PATH. Please see https
错误信息如下:WebDriverException: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home即谷歌浏览器的驱动不在PATH下。第一步:下载对应版本的chromedriver.exe下载链接:点击:关...原创 2020-02-25 17:55:17 · 13059 阅读 · 4 评论