Created
September 26, 2012 19:14
-
-
Save lisitsyn/3789950 to your computer and use it in GitHub Desktop.
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
import csv | |
import numpy | |
import time | |
class operation(): | |
def __init__(self, msg): | |
self.msg = msg | |
def __enter__(self): | |
print 'Starting %s' % self.msg | |
self.start = time.time() | |
def __exit__(self, type, value, traceback): | |
print 'Finished %s, it took %fs' % (self.msg, time.time()-self.start) | |
with operation('reading files'): | |
with open('train.csv', 'rb') as csvfile: | |
numpy.loadtxt(csvfile,delimiter=",",skiprows=1) | |
with open('test.csv', 'rb') as csvfile: | |
numpy.loadtxt(csvfile,delimiter=",",skiprows=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment