对于Seaborn的箱形图,在水平和垂直对齐方式之间切换时,请务必注意x轴和y轴的分配:
%matplotlib inlineimport pandas as pdimport seaborn as snsdf = pd.Dataframe({'a' : ['a', 'b' , 'b', 'a'], 'b' : [5, 6, 4, 3] })# horizontal boxplotssns.boxplot(x="b", y="a", data=df, orient='h')# vertical boxplotssns.boxplot(x="a", y="b", data=df, orient='v')混淆列会导致seaborn尝试计算分类数据框中的摘要统计信息,这肯定会失败。



