I have a .csv file from perfmon. The file has 6000 records and look like this:
(PDH-CSV 4.0) (SA Pacific Standard Time)(300),"\\server1\PhysicalDisk(_Total)\% Disk Read Time","\\server1\PhysicalDisk(_Total)\% Disk Write Time"
10/30/2017 15:00:15.568," "," "
10/30/2017 15:00:30.530,"25.763655942362824","130.21748494987176"
10/30/2017 15:00:45.518,"25.591636684958058","135.81093813384427"
I need to get min, max and 95 percentile from 1 and 2 column. However, as a newbie, I'm not able to pass the first challenge which consist in formatting every single value to int:
import csv
sum = 0
fila = 0
with open('datos_header.csv') as csvfile:
leercsv = csv.reader(csvfile, delimiter = ',')
csvfile.__next__()
for col in leercsv:
col1 = (col[1])
subtot = float(col1 * 4)
# fila = fila + 1
# sum = col1 + float(col)
#tot = sum / fila
print(subtot)
and get:
Traceback (most recent call last): File "", line 10, in ValueError: could not convert string to float:
I've tried: - removing the header - removing every single non-numeric like / or : values using regex - removing empty blanks
Having said that:
- Besides the error, do you think I'm on the right path to get min, max and 95 percentil?
- If so, what needs to be done to convert string to float as per my code?
- If not, would you please assist?
Thank you!