我有一个熊猫数据框df
并试图使用seaborn库创建一个小提琴情节。Python Seaborn Plot ValueError
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,sc灰度,宽度,内部,分裂,东方,线宽,颜色,调色板,饱和度,斧头,** kwargs) 2299 bw,cut,scale,scale_hue,gridsize, 2300 width,inner,split,orient,linewidth, - > 2301色,调色板,饱和度) 2303如果AX为无:
/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'
我使用.reset_index()对DF和改变数据类型的尝试,但没有运气。思考?
错字在你sns.violinplot线 –
尊敬的领主 '情绪'。谢谢。午睡时间。 – Ryan
有时候我们都需要额外的一双眼睛...但是,在你的眼睛上有成千上万的眼睛。 :)夜晚。 –