728x90
시각화 matplotlib] "barh 내림차순 정렬" plt.barh, transpose, sort_values
print('='*100)
print('원본 데이터')
print('='*100)
Cost_Guard_reason_2017 = Cost_Guard_reason.iloc[[2],:].drop('연도', axis = 1)
display(Cost_Guard_reason_2017)
print('='*100)
print('transpose를 진행한다.')
print('='*100)
Cost_Guard_reason_2017_trans = Cost_Guard_reason_2017.transpose()
display(Cost_Guard_reason_2017_trans)
print('='*100)
print('오름차순 정렬을 진행한다.')
print('='*100)
Cost_Guard_reason_2017_trans_sorted = Cost_Guard_reason_2017_trans.sort_values(by=2, ascending = True)
display(Cost_Guard_reason_2017_trans_sorted)
plt.barh(y = Cost_Guard_reason_2017_trans_sorted.index, width = Cost_Guard_reason_2017_trans_sorted[2].values)
728x90