-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessCSV.py
More file actions
71 lines (55 loc) · 1.98 KB
/
processCSV.py
File metadata and controls
71 lines (55 loc) · 1.98 KB
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
import csv
"""
#type(reader) == _csv.reader
for row in reader:
# type(row) == list # linha
for column in row:
# type(column) == str # coluna
"""
with open('arquivo.csv', 'rb') as inp, open('arquivoEdit.csv', 'wb') as out:
writer = csv.writer(out)
contador=0
for row in csv.reader(inp):
if contador >= 3 and contador < 9995 :
# do 4 ate o 10000
writer.writerow(row)
contador+=1
with open('arquivoEdit.csv', 'rb') as csvfile, open('arquivoFinal.csv', 'wb') as final:
reader = csv.reader(csvfile, delimiter=',', quotechar='|')
writere = csv.writer(final)
lista = []
contador = 0
for row in reader:
for column in row:
if "[" in column:
# " [%]"
if " [%]" in column:
column = column.replace(" [%]","")
# (Normalized) [%]
if "(Normalized)" in column:
column = column.replace("(Normalized)","Normalized")
# " [ms]" || Time*
if " [ms]" in column:
column = column.replace(" [ms]","")
column = column + str(contador)
contador+=1
# " [kHz]"
if " [kHz]" in column:
column = column.replace(" [kHz]","")
# " [KB]"
if " [KB]" in column:
column = column.replace(" [KB]","")
# "* [uW]"
if "* [uW]" in column:
column = column.replace("* [uW]","")
column = column.replace(" ","")
lista.append(column)
break # Percorre apenas a primeira linha
writere.writerow(lista)
contador=0
for row in reader:
if contador >=1 :
writere.writerow(row)
contador+=1
print(lista)
#conferir se os respectivos Times estao certos para fazer o chart com o script em R