示例#1
0
 def get_season(season, location):
     #end = (season + 1) * 100 + 29
     #epiweeks = Epidata.range(flu.add_epiweeks(end, -51), end)
     begin = season * 100 + 30
     epiweeks = Epidata.range(begin, flu.add_epiweeks(begin, 51))
     rows = AF_Utils._get(Epidata.ilinet(location, epiweeks))
     return [row['wili'] for row in rows]
示例#2
0
def get_ilinet_data(states, start, end):
    """
    return a dictionary of dataframe with the different epiweeks
    """
    ilinet_raw = {}
    for state in states:
        print("State {}".format(state))
        res = Epidata.ilinet(
            locations=state,  #source
            epiweeks=[Epidata.range(start, end)])  #range 2009 to 2016
        if res['result'] == 1:
            print(res['result'], res['message'], len(res['epidata']))
            data = pd.DataFrame(res['epidata'])
            ilinet_raw[state] = data
        else:
            print("(-2, u'no success')")
    return ilinet_raw