def advanced_statistics(): handle = 'Panel[%27hdl%3A10622/4X6NCK%27%2C%20%27hdl%3A10622/I0YK5M%27%2C%20%27hdl%3A10622/ZWRBOY%27]' handle = "Panel['hdl:10622/4X6NCK', 'hdl:10622/F16UDU', 'hdl:10622/I0YK5M']" handle = handle.replace(" ", '') print handle yearmin = '1990' yearmax = '2010' ctrlist = '' ctrlist = '250,276' config = configuration() modern = moderncodes(config['modernnames'], config['apiroot']) jsonapi = config['apiroot'] + '/api/datasets?handle=' + str(handle) (panel, cleanedpanel) = loadpanel(jsonapi, yearmin, yearmax, ctrlist) (header, data, countries, handles, vhandles) = advpanel2dict(cleanedpanel) ctrlimit = 200 #result = panel2csv(header, data, thisyear, countries, handles, vhandles, ctrlimit, modern) maindataframe = data2statistics(handles, cleanedpanel) showhtml = statistics_tojson(maindataframe, modern) return showhtml
cdata = [] cdata.append(i) countries[code] = cdata rcodes[code] = i i = i +1 panelout = {} header = 'Country,' for handle in handles: header = header + str(handle) + ',' header = header + str('Year') return (header, data, countries, handles, vhandles) panel = test_stats() if panel: totalpanel = pd.concat(panel) cleanedpanel = totalpanel.dropna(axis=1, how='any') cleanedpanel = totalpanel thisyear = 2010 config = configuration() modern = moderncodes(config['modernnames'], config['apiroot']) (header, data, countries, handles, vhandles) = panel2dict(cleanedpanel) ctrlimit = 200 result = panel2csv(header, data, thisyear, countries, handles, vhandles, ctrlimit, modern) maindataframe = data2statistics(handles, cleanedpanel) showhtml = statistics_tojson(maindataframe, modern) print showhtml
cdata.append(i) countries[code] = cdata rcodes[code] = i i = i + 1 panelout = {} header = "Country," for handle in handles: header = header + str(handle) + "," header = header + str("Year") return (header, data, countries, handles, vhandles) panel = test_stats() if panel: totalpanel = pd.concat(panel) cleanedpanel = totalpanel.dropna(axis=1, how="any") cleanedpanel = totalpanel thisyear = 2010 config = configuration() modern = moderncodes(config["modernnames"], config["apiroot"]) (header, data, countries, handles, vhandles) = panel2dict(cleanedpanel) ctrlimit = 200 result = panel2csv(header, data, thisyear, countries, handles, vhandles, ctrlimit, modern) maindataframe = data2statistics(handles, cleanedpanel) showhtml = statistics_tojson(maindataframe, modern) print showhtml