diff --git a/census_geo.py b/census_geo.py index feccd5d..5e5f530 100644 --- a/census_geo.py +++ b/census_geo.py @@ -23,8 +23,9 @@ def geocode(x): files = {'addressFile': ''.join(data_chunks[i])} response = requests.post(url, data=census_year, files=files) for block in response.iter_content(1024): + block = block.decode() buff.write(block) - outraw = buff.getvalue() + outraw = buff.getvalue().strip() cnames = ['id_number', 'input_address', 'match_status', 'match_type', 'matched_address', 'lonlat', 'tigerline_id', 'street_orientation'] df = pd.read_csv(StringIO(outraw), names=cnames, sep=',') #add malformed file handling