Created
April 5, 2019 17:47
-
-
Save ZeccaLehn/140edc75ff9d2c7cf9f660028763c9f5 to your computer and use it in GitHub Desktop.
Read Zip into Python from URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, super helpful!!