I am trying to scrape some .csv
files from a website. I currently have a list of links:
master_links = [
'http://mis.nyiso.com/public/csv/damlbmp/20161201damlbmp_zone_csv.zip',
'http://mis.nyiso.com/public/csv/damlbmp/20160301damlbmp_zone_csv.zip',
'http://mis.nyiso.com/public/csv/damlbmp/20160201damlbmp_zone_csv.zip']
when I try to use:
pd.read_csv(master_links[0])]
it returns an error because each .zip
file contains multiple .csv
within them. I understand why this isn't working, but I haven't figured out how to unzip these files, and then put the .csv files into pd.read_csv without saving everything to my computer.
Is this possible?
You can do that with a custom file reader for
pandas.read_csv()
like:Code:
Some Docs: (ZipFile) (BytesIO) (urlopen)
Test Code:
Results: