当前位置:网站首页>Typeerror: X () got multiple values for argument 'y‘
Typeerror: X () got multiple values for argument 'y‘
2022-07-02 09:12:00 【Qigui】
Individuality signature : The most important part of the whole building is the foundation , The foundation is unstable , The earth trembled and the mountains swayed . And to learn technology, we should lay a solid foundation , Pay attention to me , Take you to firm the foundation of the neighborhood of each plate .
Blog home page : Qigui's blog
From the south to the North , Don't miss it , Miss this article ,“ wonderful ” May miss you la
Triple attack( Three strikes in a row ):Comment,Like and Collect—>Attention
Today, let's share a common error report :
- Error reporting
- wedgeprops={‘width’: 0.5, ‘edgecolor’: ‘w’}) # The plot
- Error reason
- TypeError: pie() got multiple values for argument ‘explode’
Use in title ‘X’,‘Y’ Respectively replaced ‘pie’ Function and ‘explode’ Parameters . Because I think this kind of error reporting is very typical , Only functions and parameters are different , The root cause of error reporting is the same —— The number of parameters does not correspond to . Although we know the reason for the error report at present , But many people didn't think it was , I think this is just a simple error report . Actually not. .
Case one
- Code screenshot ( Mainly look at the second 19 That's ok ):

- Please see the following screenshot of error reporting :

According to the above two screenshots , You will find that the number of lines reporting errors is 19 That's ok , However, the error reason prompt is parameter error , Do you think the cow's head is not right for the horse's mouth ? Are you kidding me? .
The second case
next , My solution is to comment out the 19 Line code , To see whether other statements will also report such errors .
- Article... Has been commented out 19 Line code , The screenshot is as follows :

It is found that the error will still be reported after running , So it's obviously not the first 19 The problem of line code , that , The author will put the mistakes in ‘explode’ Parameters above . Now? , No note No 19 Line code , Replace it with a comment of 17 Line code means ‘explode’ The sentence of .
- Error reporting
- wedgeprops={‘width’: 0.5, ‘edgecolor’: ‘w’}) # The plot
- The reason for the error report is even more terrible !!!
- TypeError: can’t multiply sequence by non-int of type ‘float’
- (TypeError: Cannot associate sequence with “float” Non of type int Multiply )
The third case
What a mistake is this ??? Check step by step , It may be found that the reason for the error report is not in 17、19 These two lines of code . So , I will comment out these two lines of code together
- Screenshot of error reporting :

Sure enough , This error reporting is exactly the same as the second case , It shows that in fact, this error report follows 17、19 Line code is not directly related . Then what is wrong ?
Last , It occurred to me that , Can it be the second 16 OK, there's a problem ? lo , That's the case ! In fact, in the second case, it has been shown that the reason for the error is Multiply floating-point numbers by non numbers , therefore , The author starts from this , Find out ‘cate’ The list variable is a Chinese string , So the problem is here , We usually make the code more concise 、 Simple and often omit some unnecessary parameters , However, it may be easy to report errors , therefore , It is suggested to write the necessary parameters .
Next , stay ’cate‘ Add... Before the variable ‘labels=’
- The code is as follows :
cate = [' East China ', ' south China ', ' Central China ', ' The northwest ', ' The northeast ']
sales = [56, 31, 20, 82, 72]
plt.pie(sales, labels=cate,
explode=[0, 0, 0, 0.1, 0],
autopct='%.1f%%', pctdistance=0.8,
wedgeprops={
'width': 0.5, 'edgecolor': 'w'}) # The plot
plt.show()
Output results :
summary
Technical problems encountered , I guess most people must first choose Baidu , Of course, the author is no exception , But I chose Baidu translation .( My English is scum ) However, I know the reason for the error , According to this source, debug the number of error lines step by step ; After commissioning , If the reason for error reporting will be changed ,( As mentioned above ) Then debug again according to the error report of this change , Check which statement reports an error , Generally, it can be solved in this case .
边栏推荐
- Connect function and disconnect function of QT
- AMQ 4043 solution for errors when using IBM MQ remote connection
- Redis sorted set data type API and application scenario analysis
- Oracle修改表空间名称以及数据文件
- Count the number of various characters in the string
- QT -- how to set shadow effect in QWidget
- Matplotlib剑客行——初相识Matplotlib
- 别找了,Chrome浏览器必装插件都在这了
- 双非本科生进大厂,而我还在底层默默地爬树(上)
- 长篇总结(代码有注释)数构(C语言)——第四章、串(上)
猜你喜欢

Micro service practice | introduction and practice of zuul, a micro service gateway

Shengshihaotong and Guoao (Shenzhen) new energy Co., Ltd. build the charging pile industry chain

A detailed explanation takes you to reproduce the statistical learning method again -- Chapter 2, perceptron model

Minecraft plug-in service opening

概率还不会的快看过来《统计学习方法》——第四章、朴素贝叶斯法
![[go practical basis] how to verify request parameters in gin](/img/de/50db131d6993e5d955e3416c667c4c.png)
[go practical basis] how to verify request parameters in gin

小米电视不能访问电脑共享文件的解决方案

Matplotlib剑客行——布局指南与多图实现(更新)

Chrome视频下载插件–Video Downloader for Chrome

Actual combat of microservices | discovery and invocation of original ecosystem implementation services
随机推荐
gocv opencv exit status 3221225785
Dix ans d'expérience dans le développement de programmeurs vous disent quelles compétences de base vous manquez encore?
微服务实战|负载均衡组件及源码分析
Sentinel reports failed to fetch metric connection timeout and connection rejection
Mysql安装时mysqld.exe报`应用程序无法正常启动(0xc000007b)`
小米电视不能访问电脑共享文件的解决方案
查看was发布的应用程序的端口
C Gaode map obtains the address according to longitude and latitude
微服务实战|熔断器Hystrix初体验
Right click menu of QT
Function ‘ngram‘ is not defined
During MySQL installation, mysqld Exe reports that the application cannot start normally (0xc000007b)`
京东面试官问:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别
分布式服务架构精讲pdf文档:原理+设计+实战,(收藏再看)
Webflux responsive programming
AMQ 4043 solution for errors when using IBM MQ remote connection
Oracle修改表空间名称以及数据文件
队列的基本概念介绍以及典型应用示例
Redis安装部署(Windows/Linux)
Leetcode sword finger offer brush questions - day 23