Last active
August 29, 2015 13:57
-
-
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
This file contains 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
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