首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ValueError:无法解释输入“Rating”

ValueError:无法解释输入“Rating”
EN

Stack Overflow用户
提问于 2020-05-10 22:30:24
回答 1查看 519关注 0票数 0

我想在我的文件中添加一个图形,它显示了以下错误,并打印了一个空图形。我想要在具有值(1,2,3,4,5)的评级列和每个评级中的行数之间绘制一个图表。代码如下:

代码语言:javascript
复制
sns.set(rc={'figure.figsize':(6,6)})
plt.title('Distribution of Ratings')
sns.countplot(x = 'Rating', Edata = Edata);

错误是:

代码语言:javascript
复制
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-77-32533aad2dd0> in <module>
  1 sns.set(rc={'figure.figsize':(6,6)})
  2 plt.title('Distribution of Ratings')
----> 3 sns.countplot(x = 'Rating', Edata = Edata);

~/opt/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py in countplot(x, y, hue, 
data, order, hue_order, orient, color, palette, saturation, dodge, ax, **kwargs)
3553                           estimator, ci, n_boot, units, seed,
3554                           orient, color, palette, saturation,
-> 3555                           errcolor, errwidth, capsize, dodge)
3556 
3557     plotter.value_label = "count"

~/opt/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py in __init__(self, x, y, 
hue, data, order, hue_order, estimator, ci, n_boot, units, seed, orient, color, palette, 
saturation, errcolor, errwidth, capsize, dodge)
1613         """Initialize the plotter."""
1614         self.establish_variables(x, y, hue, data, orient,
-> 1615                                  order, hue_order, units)
1616         self.establish_colors(color, palette, saturation)
1617         self.estimate_statistic(estimator, ci, n_boot, seed)

~/opt/anaconda3/lib/python3.7/site-packages/seaborn/categorical.py in 
establish_variables(self, x, y, hue, data, orient, order, hue_order, units)
 150                 if isinstance(var, str):
 151                     err = "Could not interpret input '{}'".format(var)
--> 152                     raise ValueError(err)
 153 
 154             # Figure out the plotting orientation

ValueError: Could not interpret input 'Rating'
EN

回答 1

Stack Overflow用户

发布于 2020-09-16 12:05:47

您应该传递数据参数,而不是edata

代码语言:javascript
复制
sns.countplot(x='Rating', data=Edata);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61713669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档