-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_channels_cycle.py
62 lines (52 loc) · 1.65 KB
/
extract_channels_cycle.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
import csv
input_path = r"C:\Users\Elliot\Desktop\furi\original_datasets\myo_exp.csv"
csv_name = "extracted.csv";
i = 0
limit = 8000 * 3
pointsAdded = 0
res = ""
with open (input_path) as csvfile:
reader = csv.reader(csvfile, delimiter=",")
for row in reader:
if i < limit:
res += (str(float(row[0])) +
"," + str(float(row[1])) +
"," + str(float(row[2])) +
"," + str(float(row[3])) +
"," + str(float(row[4])) +
"," + str(float(row[5])) +
"," + str(float(row[6])) +
"," + str(float(row[7])) +
"\n")
i += 1
with open (input_path) as csvfile:
reader = csv.reader(csvfile, delimiter=",")
for row in reader:
if i < limit:
res += (str(float(row[7])) +
"," + str(float(row[0])) +
"," + str(float(row[1])) +
"," + str(float(row[2])) +
"," + str(float(row[3])) +
"," + str(float(row[4])) +
"," + str(float(row[5])) +
"," + str(float(row[6])) +
"\n")
i += 1
with open (input_path) as csvfile:
reader = csv.reader(csvfile, delimiter=",")
for row in reader:
if i < limit:
res += (str(float(row[6])) +
"," + str(float(row[7])) +
"," + str(float(row[0])) +
"," + str(float(row[1])) +
"," + str(float(row[2])) +
"," + str(float(row[3])) +
"," + str(float(row[4])) +
"," + str(float(row[5])) +
"\n")
i += 1
print(i)
with open("extracted/" + csv_name, "w") as newcsv:
newcsv.write(res)