I'm trying to unzip a csv file and pass it into pandas so I can work on the file.
The code I have tried so far is:
import requests, zipfile, StringIO
r = requests.get('http://data.octo.dc.gov/feeds/crime_incidents/archive/crime_incidents_2013_CSV.zip')
z = zipfile.ZipFile(StringIO.StringIO(r.content))
crime2013 = pandas.read_csv(z.read('crime_incidents_2013_CSV.csv'))
After the last line, although python is able to get the file, I get a "does not exist" at the end of the error.
Can someone tell me what I'm doing incorrectly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…