columns = [“性别”,“年龄”,“职业”,“城市类别”,“ Stay_In_Current_City_Years”,“婚姻状况”,“ Product_Category_1”,“ Product_Category_2”,“ Product_Category_3”]
fig = plt.figure(figsize =(30,20))
对于范围(1,len(columns)+1)中的i: df = data [[“ User_ID”,columns [i-1],“购买”]]。groupby([“ User_ID”,columns [i-1]])。agg(sum).reset_index()。sort_values(by =“购买”,升序为False) df = df.sort_values(by = columns [i-1]) ax = fig.add_subplot(3,3,i) ax = sns.boxplot(x = columns [i-1],y = np.log(df.Purchase),data = df)
在上面的代码中,ax是什么意思?如何在不使用plt.show()的情况下将boxplot分配给ax来绘制图形?