簡體   English   中英

多元數據序列的多元時間序列分析

[英]Multivariate Time Series Analysis on multiple data series

我正在關注我的數據指南。 https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/

我有來自世界銀行的數據,從1990年到今天的15個特征,但我有來自多個國家的這個時間序列。 當您有大量的時間序列時,上述指南有效。 我怎樣才能“編譯”來自不同國家的數據,但它們仍然有相同的時間,我應該在哪里看?

最好

import wbdata #pip install wbdata
indicators1 = {"EN.CLC.MDAT.ZS": "Droughts, floods, extreme temperatures (% of population, average 1990-2009)",
          "EN.ATM.CO2E.PP.GD":"CO2 emissions (kg per 2011 PPP $ of GDP)",
          "NY.GDP.PCAP.PP.KD": "GDP",
          "SP.POP.TOTL":"Total Population" ,
          "SP.POP.1564.TO.ZS":"16-64 age % Percentage of population",
          "LP.LPI.INFR.XQ":"Logistics performance index: Quality of trade and transport-related infrastructure (1=low to 5=high)",
          "EG.USE.COMM.FO.ZS":"Fossil fuel energy consumption (% of total)",
          "EG.FEC.RNEW.ZS":"Renewable energy consumption (% of total final energy consumption)",
          "EG.IMP.CONS.ZS":"Energy imports, net (% of energy use)",
          "EN.ATM.METH.KT.CE":"Methane emissions (kt of CO2 equivalent)",
          "EN.ATM.CO2E.KT":"CO2 emissions (kt)",
          "AG.LND.FRST.ZS":"Forest area (% of land area)",
          "EN.ATM.GHGT.KT.CE":"Total greenhouse gas emissions (kt of CO2 equivalent)",
          "NE.IMP.GNFS.ZS":"Imports of goods and services (% of GDP)",
          "NV.AGR.TOTL.ZS":"Agriculture, forestry, and fishing, value added (% of GDP)",
          "NE.EXP.GNFS.ZS":"Exports of goods and services (% of GDP)",
          "NY.GDP.PCAP.PP.CD":"GDP per capita, PPP (current international $)",
          "EN.ATM.NOXE.KT.CE":"Nitrous oxide emissions (thousand metric tons of CO2 equivalent)"

          }

# Store data in pandas. This  will download all requested idicators, for all     countries
df2 = wbdata.get_dataframe(indicators1, country='all', convert_date=True)
country_info  = wbdata.get_country(display=False)
data = {}
for i in range(len(country_info)):
    country_id = country_info[i]['id']
    try:
        df = wbdata.get_dataframe(indicators1, country=country_id)
        print ("Retrieved {0} record for country {1}".format(len(df), country_id))
        data[country_id] = df
        except:
            print ("No records for country {0}".format(country_id)) 
  • 獲取所有國家/地區代碼
  • 按國家/地區級別讀取信息並將其推送到數據字典中

您還可以創建您感興趣的所有國家/地區ID的列表,並在一次調用中將其傳遞給get_dataframe

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM