I'm trying to download a csv file to local disc and I'm getting the error:
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 253967: invalid continuation byte"
What is the best/easiest way to get around this error, and why is this popping up as an error?
import requests
import pandas as pd
import csv
url = 'https://www2.census.gov/programs-surveys/popest/datasets/2010-2019/counties/totals/co-est2019-alldata.csv'
df = pd.read_csv(url)
df = df['SUMLEV', 'REGION', 'DIVISION', 'STATE', 'COUNTY', 'STNAME', 'CTYNAME', 'POPESTIMATE2019']
df.to_csv('C:\localpath.csv', index=False)