Skip to content

Instantly share code, notes, and snippets.

Created May 1, 2014 19:34
Show Gist options
  • Save anonymous/11459732 to your computer and use it in GitHub Desktop.
Save anonymous/11459732 to your computer and use it in GitHub Desktop.
Pasted from IPython
import csv
reader = csv.reader(open('1.csv', 'rb'), delimiter=',', quotechar='"')
d = {}
for row in reader:
d[row[0]] = row[1]
temp_list1 = d.keys()
set(temp_list1) & set(temp_list2)
common_Hz = set(temp_list1) & set(temp_list2)
for fq in commonHz:
print d[fq], d2[fq]
@arcolife
Copy link

arcolife commented May 1, 2014

import csv
reader = csv.reader(open('1.csv', 'rb'), delimiter=',', quotechar='"')
d = {}
for row in reader:
    d[row[0]] = row[1]
temp_list1 = d.keys()

reader = csv.reader(open('2.csv', 'rb'), delimiter=',', quotechar='"')
d2 = {}
for row in reader:
    d2[row[0]] = row[1]
temp_list2 = d2.keys()

common_Hz = set(temp_list1) & set(temp_list2)

for fq in common_Hz:
    print d[fq], d2[fq]

@arcolife
Copy link

arcolife commented May 1, 2014

{'0': '2.62646',
 '1040': '-82.059077',
 '1120': '-84.06587',
 '1200': '-86.526905',
 '1280': '-87.934101',
 '1360': '-84.621532',
 '1440': '-81.005851',
 '1520': '-83.815552',
 '160': '-44.544673',
 '1600': '-87.832612',
 '1680': '-91.961123',
 '1760': '-81.187397',
 '1840': '-81.660828',
 '1920': '-87.289726',
 '2000': '-85.195929',
 '2080': '-84.788808',
 '2160': '-81.833661',
 '2240': '-83.691184',
 '2320': '-90.794096',
 '240': '-60.904309',
 '2400': '-89.723049',
 '2480': '-97.40528',
 '2560': '-82.022904',
 '2640': '-84.198876',
 '2720': '-86.880303',
 '2800': '-83.413886',
 '2880': '-86.815155',
 '2960': '-84.954212',
 '3040': '-85.951321',
 '3120': '-90.733819',
 '320': '-72.157979',
 '3200': '-86.829072',
 '3280': '-81.452963',
 '3360': '-80.184706',
 '3440': '-80.809713',
 '3520': '-85.160461',
 '3600': '-88.161165',
 '3680': '-82.377298',
 '3760': '-81.853541',
 '3840': '-89.208339',
 '3920': '-86.377709',
 '400': '-70.716375',
 '480': '-71.987872',
 '560': '-71.107531',
 '640': '-76.001908',
 '720': '-80.977883',
 '80': '-0.351255',
 '800': '-83.559991',
 '880': '-79.829409',
 '960': '-81.141121',
 'Frequency (Hz) - Plot 0': 'dB V^2 rms - Plot 0'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment