【发布时间】:2021-04-18 10:25:07
【问题描述】:
我旋转了一个 DF,根据我想要的组织设置了索引。
但我无法创建 x 轴为年份和每个国家/地区及其价值的图表。为了展示每个国家的演变。
我尝试了 Seaborn 和 Matplotlib,但我无法做到。
我的 GitHub 链接:https://github.com/IgorComune/RenewableEnergy/blob/main/RenewableEnergy.ipynb
table = pd.pivot_table(top_20_average,index=['country','year'])
table
country year gerenation_renewables_per_capita
Austria 2000 5382.823150
2001 5215.238330
2002 5150.725350
2003 4311.643836
2004 4822.806377
... ... ...
Venezuela 2015 2467.522106
2016 2090.616730
2017 2039.997279
2018 1995.568941
2019 1827.675691
380 rows × 1 columns
【问题讨论】:
标签: python pandas matplotlib seaborn pivot-table