Created
September 29, 2018 02:17
-
-
Save craigcalef/f2e801250a44096b5f055e6f3a9f0637 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 pprint | |
with open('salesdata.csv', 'r') as f: | |
cars = [{k: v for k, v in row.items()} for row in csv.DictReader(f, skipinitialspace=True)] | |
fords = filter(lambda x: x['Make'] == 'FORD', cars) | |
v8 = filter(lambda x: '5.8' in x['Engine'], fords) | |
zips = open('zips.txt', 'r').read().strip().split(',') | |
local = filter(lambda x: x['Location ZIP'] in zips, v8) | |
if local: | |
pprint.pprint(local) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment