当前位置:网站首页>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 .
边栏推荐
- Mirror protocol of synthetic asset track
- Solution to amq4036 error in remote connection to IBM MQ
- WSL安装、美化、网络代理和远程开发
- Introduction to the basic concept of queue and typical application examples
- Jingdong senior engineer has developed for ten years and compiled "core technology of 100 million traffic website architecture"
- Oracle modify database character set
- Win10 uses docker to pull the redis image and reports an error read only file system: unknown
- [go practical basis] how to set the route in gin
- [go practical basis] how to verify request parameters in gin
- Oracle related statistics
猜你喜欢

盘点典型错误之TypeError: X() got multiple values for argument ‘Y‘

Cloudreve自建云盘实践,我说了没人能限制得了我的容量和速度

京东面试官问:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别

别找了,Chrome浏览器必装插件都在这了

十年开发经验的程序员告诉你,你还缺少哪些核心竞争力?

Matplotlib剑客行——初相识Matplotlib

以字节跳动内部 Data Catalog 架构升级为例聊业务系统的性能优化

Chrome浏览器标签管理插件–OneTab

微服务实战|声明式服务调用OpenFeign实践

微服务实战|熔断器Hystrix初体验
随机推荐
Hengyuan cloud_ Can aiphacode replace programmers?
oracle删除表空间及用户
Ora-12514 problem solving method
Microservice practice | teach you to develop load balancing components hand in hand
「面试高频题」难度大 1.5/5,经典「前缀和 + 二分」运用题
[staff] the lines and spaces of the staff (the nth line and the nth space in the staff | the plus N line and the plus N space on the staff | the plus N line and the plus N space below the staff | the
JVM指令助记符
Gocv boundary fill
[go practical basis] how to install and use gin
Minecraft install resource pack
[staff] time mark and note duration (staff time mark | full note rest | half note rest | quarter note rest | eighth note rest | sixteenth note rest | thirty second note rest)
Redis zadd导致的一次线上问题排查和处理
C nail development: obtain all employee address books and send work notices
双非本科生进大厂,而我还在底层默默地爬树(上)
数构(C语言)——第四章、矩阵的压缩存储(下)
统计字符串中各类字符的个数
Using recursive functions to solve the inverse problem of strings
Win10 uses docker to pull the redis image and reports an error read only file system: unknown
Microservice practice | declarative service invocation openfeign practice
win10使用docker拉取redis镜像报错read-only file system: unknown