# 'TAXIED 19:59', # 'LAST CALL', def getstatustime(status): import re import dateutil.parser as dparser pattern = '([0-1][0-9]|[2][0-3]):([0-5][0-9])$' """ 0-1 followed by 0-9 OR 2 followed by 0-3 ; followed by : ; followed by 0-5 followed by 0-9 $ -> pattern must be at the end of the string """ if re.search(pattern,status): return dparser.parse(status, fuzzy=True) else: return None gatwdata.datetimestatus = gatwdata.datetimestatus.map(getstatustime) # datetimestatus day set to today the status column only provide time information # fuzzy=true uses today's data when no date information is found import csv f = open('/Users/aidanoboyle/Documents/2014-06-18-22-14.dubl.csv') csvraw = csv.reader(f) m = [] m = [line for line in csvraw] # direction = []