epogrebnyak / data-rosstat-kep

Time series dataset of Rosstat Short-term Economic Indicators ("KEP") publication
http://www.gks.ru/wps/wcm/connect/rosstat_main/rosstat/ru/statistics/publications/catalog/doc_1140080765391
6 stars 6 forks source link

End-use: need wrappers to read csv files from URL in python and in R #92

Closed epogrebnyak closed 8 years ago

epogrebnyak commented 8 years ago

Apparent python URL getter:


import pandas as pd

URL_DIR = "https://raw.githubusercontent.com/epogrebnyak/rosstat-kep-data/master/output/"
DFA_URL = URL_DIR  + "data_annual.txt"
DFQ_URL = URL_DIR  + "data_quarter.txt"
DFM_URL = URL_DIR  + "data_monthly.txt"

dfa = pd.read_csv(DFA_URL)
dfq = pd.read_csv(DFQ_URL)
dfm = pd.read_csv(DFM_URL)

# set time index
self.dfq.index = pd.to_datetime(self.dfq.index)    
self.dfm.index = pd.to_datetime(self.dfm.index)

#summary(DFA)

Apparent R getter:


URL_DIR <- "https://raw.githubusercontent.com/epogrebnyak/rosstat-kep-data/master/output/"
DFA_URL <- URL_DIR +"data_annual.txt"
DFQ_URL <- URL_DIR +"data_quarter.txt"
DFM_URL <- URL_DIR +"data_monthly.txt"

dfa <- read.table(DFA_URL) # header=TRUE, sep="", na.strings="NA", dec=".", strip.white=TRUE)
dfq <- read.table(DFQ_URL) 
dfm <- read.table(DFM_URL) 

#need set frequencies DFQ, DFM

summary(DFA)
epogrebnyak commented 8 years ago

Need R clone of https://github.com/epogrebnyak/rosstat-kep-data/blob/master/interface_pandas.py, draft in comment above.