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

Df manipulation not sucessful #90

Closed epogrebnyak closed 8 years ago

epogrebnyak commented 8 years ago

Formerly in https://github.com/epogrebnyak/rosstat-kep-data/blob/master/kep/test/pytest/new/test_spec_cfg_and_data.py

# PROBLEM: I want following statement to pass, my intent is to have hardcoded version of the dataframe as above
#          which I can convert to datframe by reading in with pd.read_csv():
#
# assert_frame_equal(dfa, pd.read_csv(io.StringIO(dfa.to_csv())))
#
# the data inside dataframes is identical, the problem is labels
# the roots of the problem are here: https://github.com/epogrebnyak/rosstat-kep-data/blob/master/kep/query/save.py#L37-L41
# a lot of pivoting is done and labels are nested. 

#def string_to_df(string):
#    tempfile = io.StringIO(string)
#    return pd.read_csv(tempfile)

#DFA = string_to_df(dfa_csv)
#DFQ = string_to_df(dfq_csv)
#DFM = string_to_df(dfm_csv)

#assert_frame_equal(dfa, DFA)
#assert_frame_equal(dfq, DFA)
#assert_frame_equal(dfm, DFM)