[英]Plot multiple bar graph of multiple pandas dataframe columns generated in a for loop
[英]Pandas dataframe multiple columns bar plot
按Age
列創建索引(如有必要),然后rename
列並最后使用DataFrame.plot.bar
:
d = {'Index 1':'Payment', 'Index 2':'Gender Focus',
'Index 3':'H&S General', 'Index 4': 'H&S Covid 19'}
df.set_index('Age').rename(columns=d).plot.bar()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.