def map_blank_to_na(csvfile):
    """
    Convert all blank csv fields to 'NA'.

    Yield the csv header,
    and then yield each csv row with
    all blank fields replaced by NAs.
    """
    yield next(csvfile)
    for row in csvfile:
        yield map(lambda f: f if f != '' else 'NA', row)
