results/format-covid-forecast/format_data_county_case.py
def load_csv(input_filename):
    """
    Read our forecast reports and return a dictionary structuring of <date_str, <region_id, value>>
    e.g.
    {
        "2020-06-22": {
            '10': 2000.0,
            '11': 3000.0,
            ...
        },

        "2020-06-23": {
            '10': 800.0,
            '11': 900.0,
            ...
        },
        ...
    }
    """
    dataset = {}
    with open(input_filename) as f:
        reader = csv.reader(f)
        header = next(reader, None)

        for i in range(2, len(header)):
            date_str = header[i]
            # Initialize the dataset entry on each date.
            dataset[date_str] = {}

        for row in reader:
            region_id = row[1].strip().zfill(5)

            # Skip the region if it is not listed in reichlab's region list.
            if region_id not in ID_REGION_MAPPING:
                continue

            for i in range(2, len(header)):
                date_str = header[i]
                val = float(row[i])
                if math.isnan(val) or val < 0:
                    val = 0
                dataset[date_str][region_id] = val

    return dataset

    Read our forecast reports and return a dictionary structuring of <date_str, <region_id, value>>
    e.g.
    {
        "2020-06-22": {
            '10': 2000.0,
            '11': 3000.0,
            ...
        },

        "2020-06-23": {
            '10': 800.0,
            '11': 900.0,
            ...
        },
        ...
    }
    
Read our forecast reports and return a dictionary structuring of >
e.g.


Read our forecast reports and return a dictionary structuring of > e . g .
def load_csv(input_filename):
    dataset = {}
    with open(input_filename) as f:
        reader = csv.reader(f)
        header = next(reader, None)
        for i in range(2, len(header)):
            date_str = header[i]
            dataset[date_str] = {}
        for row in reader:
            region_id = row[1].strip().zfill(5)
            if region_id not in ID_REGION_MAPPING:
                continue
            for i in range(2, len(header)):
                date_str = header[i]
                val = float(row[i])
                if math.isnan(val) or val < 0:
                    val = 0
                dataset[date_str][region_id] = val
    return dataset
def load_csv ( input_filename ) : dataset = { } with open ( input_filename ) as f : reader = csv . reader ( f ) header = next ( reader , None ) for i in range ( 2 , len ( header ) ) : date_str = header [ i ] dataset [ date_str ] = { } for row in reader : region_id = row [ 1 ] . strip ( ) . zfill ( 5 ) if region_id not in ID_REGION_MAPPING : continue for i in range ( 2 , len ( header ) ) : date_str = header [ i ] val = float ( row [ i ] ) if math . isnan ( val ) or val < 0 : val = 0 dataset [ date_str ] [ region_id ] = val return dataset
Read our forecast reports and return a dictionary structuring of <date_str, <region_id, value>>
e.g.
Read our forecast reports and return a dictionary structuring of <date_str <region_id value >> e . g .
"""
    Read our forecast reports and return a dictionary structuring of <date_str, <region_id, value>>
    e.g.
    {
        "2020-06-22": {
            '10': 2000.0,
            '11': 3000.0,
            ...
        },

        "2020-06-23": {
            '10': 800.0,
            '11': 900.0,
            ...
        },
        ...
    }
    """ # Initialize the dataset entry on each date. # Skip the region if it is not listed in reichlab's region list.
input_filename