当前位置:网站首页>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 .
边栏推荐
- 微服务实战|Eureka注册中心及集群搭建
- Pdf document of distributed service architecture: principle + Design + practice, (collect and see again)
- C nail development: obtain all employee address books and send work notices
- 概率还不会的快看过来《统计学习方法》——第四章、朴素贝叶斯法
- Oracle 相关统计
- Find the node with the smallest value range in the linked list and move it to the front of the linked list
- Jingdong senior engineer has developed for ten years and compiled "core technology of 100 million traffic website architecture"
- 以字节跳动内部 Data Catalog 架构升级为例聊业务系统的性能优化
- From concept to method, the statistical learning method -- Chapter 3, k-nearest neighbor method
- [go practical basis] how to bind and use URL parameters in gin
猜你喜欢
[staff] time sign and note duration (full note | half note | quarter note | eighth note | sixteenth note | thirty second note)
win10使用docker拉取redis镜像报错read-only file system: unknown
Troubleshooting and handling of an online problem caused by redis zadd
Oracle modify database character set
Redis zadd导致的一次线上问题排查和处理
微服务实战|手把手教你开发负载均衡组件
WSL installation, beautification, network agent and remote development
Watermelon book -- Chapter 5 neural network
[go practical basis] how to bind and use URL parameters in gin
How to realize asynchronous programming in a synchronous way?
随机推荐
Dix ans d'expérience dans le développement de programmeurs vous disent quelles compétences de base vous manquez encore?
Microservice practice | declarative service invocation openfeign practice
Move a string of numbers backward in sequence
Watermelon book -- Chapter 6 Support vector machine (SVM)
[go practical basis] how to bind and use URL parameters in gin
【Go实战基础】gin 高效神器,如何将参数绑定到结构体
Solution to amq4036 error in remote connection to IBM MQ
AMQ 4043 solution for errors when using IBM MQ remote connection
Oracle modify database character set
[go practical basis] how to set the route in gin
机器学习实战:《美人鱼》属于爱情片还是动作片?KNN揭晓答案
[go practical basis] how to verify request parameters in gin
Cloudreve自建云盘实践,我说了没人能限制得了我的容量和速度
队列的基本概念介绍以及典型应用示例
Solution of Xiaomi TV's inability to access computer shared files
Chrome用户脚本管理器-Tampermonkey 油猴
MYSQL安装出现问题(The service already exists)
gocv opencv exit status 3221225785
告别996,IDEA中必装插件有哪些?
Count the number of various characters in the string