[英]Python Seaborn Plot ValueError
我有一個pandas數據幀df
,我正在嘗試使用seaborn庫創建一個小提琴圖。
rank sentiment category
0 1 0.657413 m
1 2 0.895769 m
2 3 -0.435457 m
3 4 -0.717959 m
4 5 0.869688 m
這是seaborn線:
sns.violinplot(x="rank", y="senitment", hue="category", data=df)
我一直得到這個ValueError
ValueError: Could not interpret input 'senitment'
完全追溯
/Users/jrs/anaconda/lib/python3.5/site-packages/seaborn/categorical.py in violinplot(x,y,hue,data,order,hue_order,bw,cut,scale,scale_hue,gridsize,width,inner ,分裂,東方,線寬,顏色,調色板,飽和度,軸,** kwargs)2299 bw,切割,比例,scale_hue,網格化,2300寬度,內部,分割,定向,線寬, - > 2301顏色,調色板,飽和度)如果ax為None,則為2302 2303:
/Users/jrs/anaconda/lib/python3.5/site-packages/seaborn/categorical.py in __init__(self, x, y, hue, data, order, hue_order, bw, cut, scale, scale_hue, gridsize, width, inner, split, orient, linewidth, color, palette, saturation)
535 color, palette, saturation):
536
--> 537 self.establish_variables(x, y, hue, data, orient, order, hue_order)
538 self.establish_colors(color, palette, saturation)
539 self.estimate_densities(bw, cut, scale, scale_hue, gridsize)
/Users/jrs/anaconda/lib/python3.5/site-packages/seaborn/categorical.py in establish_variables(self, x, y, hue, data, orient, order, hue_order, units)
145 if isinstance(input, string_types):
146 err = "Could not interpret input '{}'".format(input)
--> 147 raise ValueError(err)
148
149 # Figure out the plotting orientation
ValueError: Could not interpret input 'senitment'
我嘗試在df和更改數據類型上使用.reset_index(),但沒有運氣。 思考?
sns.violinplot(x="rank", y="sentiment", hue="category", data=df)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.