-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfast.py
More file actions
41 lines (28 loc) · 827 Bytes
/
Copy pathfast.py
File metadata and controls
41 lines (28 loc) · 827 Bytes
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
#about twice as fast compared to slow
# run with python fast.py file1.csv
# or
# run with python fast.py file1.csv file2.csv
import sys;
import csv;
import numpy as np;
import time;
#only timer
print('started');
start_time = time.time();
# this is the data later
data_array = []; # = np.empty(len(sys.argv), dtype='int32');
i = 0;
for arg in sys.argv[1:]:
dest_file = arg
delimit = ','
with open(dest_file,'r') as dest_f:
data_iter = csv.reader(dest_f,
delimiter = delimit,
quotechar = '"')
data = [data for data in data_iter];
data_array.append(np.asarray(data, dtype = 'int32'));
np.save(str(i), data_array[i]);
i = i + 1;
#end timer
print("--- %s seconds ---" % (time.time() - start_time));
print("done ");