ValueError:颜色Kwarg每个数据集必须具有一种颜色。提供了4462个数据集和1种颜色
我有一个我不理解的错误,这是很新的,所以请提前感谢! 我正在使用jupyter笔记本(anaconda3)此处的链接显示我的代码和错误消息
I have an error that I do not comprehend, am quite new to this so thank you all in advance!
I am using Jupyter Notebook (Anaconda3)The link here shows my code and error message
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是您的维度
all_unbalenced_data
array/list。如果您使用的是n维数据(n个不同的数据集,数据列表等)作为
plt.hist.hist
的输入,则color
kwarg必须是相同的维度。您输入一种颜色,因此,要使脚本工作,您的数据必须形成为1维数组。
经验法则
假设您的数据包含在一个数组中:
比您可以提取数组的形状( dimensionality ):
颜色的数量
plt.hist.hist
将预计将为2:因此,在您的情况下,
plt.hist
期望有4462种不同的颜色。The problem is the dimensionality of your
all_unbalanced_data
array/list.If you are using an N-dimensional data (N different datasets, lists of data, etc) as input to
plt.hist
, then thecolor
kwarg must be of the same dimensionality.You input one single color, so for the script to work your data must be shaped as a 1-dimensional array.
A rule of thumb
Suppose your data are contained in a numpy array:
Than you can extract the shape (dimensionality) of the array:
The the number of colors
plt.hist
will expect will be 2:So in your case
plt.hist
is expecting 4462 different colors.