Skip to content

Instantly share code, notes, and snippets.

@miraculixx
Created March 1, 2019 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miraculixx/ccc93eb7e2edc763c56517ddacca629b to your computer and use it in GitHub Desktop.
Save miraculixx/ccc93eb7e2edc763c56517ddacca629b to your computer and use it in GitHub Desktop.
read a large csv file and subset on datetime column
from dateutil.parser import parse
with open('data.csv') as fin:
for line in csv.reader(fin):
date1 = parse(row[1])
date2 = datetime.now() - timedelta(days=3)
if date1 > date2:
continue
process(row) # whatever your logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment