Skip to content

Instantly share code, notes, and snippets.

@jseabold
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jseabold/9541891 to your computer and use it in GitHub Desktop.
Save jseabold/9541891 to your computer and use it in GitHub Desktop.
Quick no-features version of R's scan to be used for URLs only
from urllib2 import urlopen
from itertools import chain
def scan(url, sep=" ", skiprows=0):
f = urlopen(url).readlines()[skiprows:]
return map(float, chain(*map(lambda x : x.strip().split(sep), f)))
if __name__ == "__main__":
url = "http://robjhyndman.com/tsdldata/hurst/precip1.dat"
scan(url, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment