[英]Multivariate Time Series Analysis on multiple data series
I am following this guide on my data. 我正在关注我的数据指南。 https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/
https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/
I have data from the World Bank, 15 features from 1990 to today, but I have this time series from multiple countries. 我有来自世界银行的数据,从1990年到今天的15个特征,但我有来自多个国家的这个时间序列。 The above guide works when you have a large time series.
当您有大量的时间序列时,上述指南有效。 How can I "compile" data from different countries while they still have the same time and where shall I look?
我怎样才能“编译”来自不同国家的数据,但它们仍然有相同的时间,我应该在哪里看?
Best 最好
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))
You can also create a list of all the country id's you are interested in and pass it to get_dataframe
in a single call. 您还可以创建您感兴趣的所有国家/地区ID的列表,并在一次调用中将其传递给
get_dataframe
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.