-
Notifications
You must be signed in to change notification settings - Fork 1
/
Explore_csv_files.py
87 lines (40 loc) · 1.41 KB
/
Explore_csv_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python
'''
Code to read the file original, partial datafiles and compile an file with
useful info with paper_id, year, subject_category, issue_id
Created by Julia Poncela, on Dec. 2015
'''
import datetime as dt
import csv
import pickle
import histogram_bins_increasing
import numpy as np
import networkx as nx
import random
import sys
def main():
path="../Data/95_05NYCgamentdata/"
##################
####### input datafile:
name0="Fhistory1996.xls"
print "reading: ", path+name0, "......."
#### paidbyfi,paidforf,periodfr,periodto,adjgr,gross,net,caf,liqdmg,cafper,rateper,ratecode
cont=0
with open(path+name0, 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
for list_row in spamreader:
manufacturer=list_row[0] ##paidbyfirm
contractor=list_row[1] ## paidforfirm
from_date=list_row[2]
to_date=list_row[3]
adj_gross=list_row[4]
print manufacturer, contractor, from_date, to_date, adj_gross
######################################
######################################
######################################
if __name__ == '__main__':
# if len(sys.argv) > 1:
# graph_filename = sys.argv[1]
main()
#else:
# print "Usage: python script.py "