下面是我的代码。 x标签不会旋转。
bins=pd.cut(df_train['Fare'],[0,5,10,15,20,30,40,50,100,250,500])
age=df_train.groupby(bins)['Survived'].agg(['mean'])
g=sns.barplot(x='Fare', y='mean',data=age.reset_index(), color='b')
g.set_xticklabels(rotation=30)
错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-169-395f6cf89c4c> in <module>()
2 age=df_train.groupby(bins)['Survived'].agg(['mean'])
3 g=sns.barplot(x='Fare', y='mean',data=age.reset_index(), color='b')
----> 4 g.set_xticklabels(rotation=30)
TypeError: set_xticklabels() missing 1 required positional argument: 'labels'