You still need to process each line in the file in order to validate your proposal. However, there is no need to load the entire file into memory, so you can use streams as follows:
import csv with open('huge.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='"') for row in spamreader: if row[0] == '2015/03/01': continue
If you just need to have a list of matching lines, itβs faster and even easier to use list comprehension as follows:
import csv with open('huge.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='"') rows = [row for row in spamreader if row[0] == '2015/03/01']
max
source share