Skip to content

Instantly share code, notes, and snippets.

@ftfarias
Created November 3, 2017 19:38
Show Gist options
  • Save ftfarias/4c2a386ab7b03ef09f8bcc0232623650 to your computer and use it in GitHub Desktop.
Save ftfarias/4c2a386ab7b03ef09f8bcc0232623650 to your computer and use it in GitHub Desktop.
Read from zipped file in internet
import requests
from io import BytesIO
from zipfile import ZipFile
# Download the dataset
dk = requests.get('http://www.ssfpack.com/files/DK-data.zip').content
f = BytesIO(dk)
zipped = ZipFile(f)
df = pd.read_table(
BytesIO(zipped.read('internet.dat')),
skiprows=1, header=None, sep='\s+', engine='python',
names=['internet','dinternet']
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment