12 2020 档案
摘要:原文链接:http://www.juzicode.com/archives/3273 错误提示: 利用pandas绘制多个子图时报错:AttributeError: ‘list’ object has no attribute ‘get_figure’ #...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/3139 错误提示: pyplot.hist()绘制直方图时提示:ValueError: x must have 2 or fewer dimensions #juzicode.c...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/3112 pandas为我们提供了容易上手使用的数据结构和数据分析工具,它的Series和DataFrame数据类型都有一个plot()方法,可以用于绘制常用图形。 1、线型图、基...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/3127 错误提示: 在pandas中用to_excel()写文件提示:ModuleNotFoundError: No module named ‘xlwt’: import nu...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/3125 错误提示: 用pandas read_excel()方法读取xls或xlsx文件时,提示:ImportError: Missing optional dependency...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2530 matplotlib除了可以绘制曲线图, 还可以绘制统计图形,这篇文章介绍饼图、柱状图等几种常用统计图形的绘制方法。 1、饼图 使用pie()方法绘制饼图: pr...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2532 在matploblib中,绘图操作通常可以用pyplot.plot()实现,但是如果需要在一个画布上绘制多张图片,则需要用到subplots()或subplot()方法。 1...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2455 在做数据处理时用图形显示出处理结果,可以得到更直观的判断。Python中matplotlib为我们提供了非常强大的绘图功能,它可以绘制曲线图、柱图、饼图、散点图、三维图等...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2840 错误提示: 定义函数时,使用三引号注释提示错误:IndentationError: expected an indented block #juzicode.com/vx:桔...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2756 错误提示: 开启线程时提示TypeError: func() argument after * must be an iterable, not int #juzicod...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2749 错误提示: 使用with方法打开文件后,再次read()文件时提示:ValueError: I/O operation on closed file. #juzicode.c...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2745 错误提示: 读写文件时提示UnsupportedOperation: not readable #juzicode.com/vx:桔子codefileobj=open('ex...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2736 错误提示: 字符串到10进制转换时提示:ValueError: invalid literal for int() with base 10: ‘1a’ #juzico...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2731 错误提示: 使用%s格式化tuple类型的字符串时提示: TypeError: not all arguments converted during string forma...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2725 错误提示: 格式化字符串时提示index超出范围:IndexError: Replacement index 5 out of range for positional ar...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2720 错误提示: #juzicode.com/vx:桔子codes1={1,2,3,4}#集合s1s2={3,4,5,6}#集合s2print('s1-s2:',s1-s2)pri...
阅读全文
Python错误集锦:list dict类型的数据作为set元素TypeError: unhashable type: ‘list‘ TypeError: unhashable type: ‘dict
摘要:原文链接:http://www.juzicode.com/archives/2715 错误提示: 构建set类型的数据时,使用tuple类型的数据作为元素没有问题,使用list、dict类型的数据作为元素报TypeError: unhashable type:...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2711 错误提示: list使用数字类型的下标访问没有问题,字典使用数字类型的下标访问时提示KeyError: 0 #juzicode.com/vx:桔子codel = ['juzi...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2692 错误提示: 调用列表的元素时提示:IndexError: list assignment index out of range #juzicode.com/vx:桔子cod...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2706 错误提示: 用tuple类型的数据作为字典的key不报错,用list类型的数据作为字典的key时,提示TypeError: unhashable type: ‘list’ ...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2701 错误提示: 使用list的index方法查找元素时提示:ValueError: 20 is not in list #juzicode.com/vx:桔子codelst = ...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2669 错误提示:进行除法运算时,提示ZeroDivisionError: division by zero #juzicode.com/vx:桔子codelst = [5,4,3,...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2498 错误提示: 使用matplotlib画子图时提示:ValueError: Single argument to subplot must be a three-digit i...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2672 错误提示: 使用print()函数打印字符串,提示print后面的括号是无效字符:SyntaxError: invalid character in identifier #...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2575 要画桔子,先对着个桔子看几分钟: 看完了桔子该动手了,先画个外形: print('\n-----欢迎来到juzicode.com')print('-----公众号: 桔子c...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2493 错误提示: 打开文件路径提示参数无效:OSError: [Errno 22] Invalid argument: ‘D:\juzicode\桔子code\readme.txt...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2486 错误提示: 使用matplotlib legend提示:ValueError: Unrecognized location ‘upper’. Valid location...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2411 错误提示: 进行加减法运算时提示:TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’: D:\ju...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2421 在matplotlib中默认是不能正常显示中文: import numpy as npimport matplotlib.pyplot as pltimport matp...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/1466 前两天桔子菌在调试代码的时候发现自己写的一个方法怎么也执行不到,这个自定义的类大概是下面这样子的: class ClassA(object): def __init__...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2364 错误提示: 使用变量时提示NameError: name ‘a’ is not defined D:\juzicode>python test-not-define.py微信...
阅读全文
摘要:原文链接:http://www.juzicode.com/archives/2344 某些命令在windows cmd命令行下提示“请求的操作需要提升”: 发生这种错误一般是因为启动cmd是以普通用户打开的,需要用管理员身份启动命令行,可以新建”启动命令...
阅读全文
摘要:在《编码: 一个隐藏了30多年的bug,Windows含蓄说过某通不行?》一文中我们简单讨论了Unicode和UTF-8的关系,UTF-8本身并不是一种字符集,而是实现Unicode字符集的一种编码方式。RFC3629规定的Unicode字符集和UTF-8编码...
阅读全文

浙公网安备 33010602011771号