〇出力グラフ
〇コード
from pandasdmx import Request
import matplotlib.pyplot as plt
oecd = Request('OECD')
countries="AUS"
data_response = oecd.data(resource_id='HIGH_AGLINK_2018', key=countries + ".ET+BD.QP/all?startTime=2017&endTime=2027")
oecd_data = data_response.data
df = data_response.write(oecd_data.series, parse_time=True)
df = df.unstack(level=0).to_frame()
df.columns=['Biofuel(Kt)']
df = df.reset_index()
df = df[["COMMODITY", "TIME_PERIOD", "Biofuel(Kt)"]]
df.set_index(["COMMODITY", "TIME_PERIOD"], inplace=True)
df = df.rename(index={'ET':'Ethanol', 'BD':'Biodiesel'})
ax = df.unstack(level=0).plot()
plt.xticks(rotation=90)
plt.legend(loc='best')
plt.show()
〇元データ
OECD-FAO Agricultural Outlook 2018-2027
https://stats.oecd.org/Index.aspx?DataSetCode=HIGH_AGLINK_2018
○関連情報
・Pandasdmxに関する他の記事はこちらを参照してください。