如何将这 4 个图放在子图中?我正在研究贷款批准预测数据集

问题描述

gender = pd.crosstab(training_set['Gender'],training_set['Loan_Status'])
married=pd.crosstab(training_set['Married'],training_set['Loan_Status'])
dependents=pd.crosstab(training_set['Dependents'],training_set['Loan_Status'])
education=pd.crosstab(training_set['Education'],training_set['Loan_Status'])
self_employed=pd.crosstab(training_set['Self_Employed'],training_set['Loan_Status'])

plt.subplot(2,2,1)
性别.div(gender.sum(1).astype(float),axis = 0).plot(kind = 'bar',stacked = True,figsize = (4,4)) plt.show()

plt.subplot(2,2)
已婚.div(已婚.sum(1).astype(float),axis=0).plot(kind='bar',stacked=True,figsize=(4,3)
dependents.div(dependents.sum(1).astype(float),4))

plt.subplot(2,4)
教育.div(education.sum(1).astype(float),4)) plt.show()

self_employed.div(self_employed.sum(1).astype(float),4))
plt.show()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)