Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
Created April 5, 2019 17:47
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ZeccaLehn/140edc75ff9d2c7cf9f660028763c9f5 to your computer and use it in GitHub Desktop.
Save ZeccaLehn/140edc75ff9d2c7cf9f660028763c9f5 to your computer and use it in GitHub Desktop.
Read Zip into Python from URL
import requests, zipfile, io
url = 'https://www.huduser.gov/portal/datasets/hads/hads2013n_ASCII.zip'
filename = 'thads2013n.txt'
r = requests.get(url)
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall()
import pandas as pd
df = pd.read_csv(filename, sep=',')
df
@alexanderpegoto
Copy link

Thanks, super helpful!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment