python - IOError when trying to convert CSV into dataframe -
i want try , understand why error in following code. error ioerror: [errno 2] no such file or directory: 'f17-yields.csv'
import urllib2 import pandas pd import os url = 'http://www.rba.gov.au/statistics/tables/csv/f17-yields.csv' response = urllib2.urlopen(url) html = response.read() dataframeofxls_file = pd.excelfile(os.path.basename(url)) print dataframeofxls_file
cheers
you have few problems. first downloading csv file, not saving locally, , trying open non-existent local file.
second, csv file not excel file, , don't need pd.excelfile
open it. try csv reader instead. example:
import pandas pd url = 'http://www.rba.gov.au/statistics/tables/csv/f17-yields.csv' pd.read_csv(url)
Comments
Post a Comment