I have a main program built in C++ that generates a CSV file. I've made an interface with PyQt5 and I want to read some specific columns from that CSV.
I can read but I want to store them to make a plot with matplotlib. Probably my fault is that I'm trying to work with the row like if it is an array. This is how my readfile function looks:
def readCSV(self):
try:
with open('resultado.csv') as csvFile:
reader = csv.DictReader(csvFile, delimiter=';')
i = 0
x, y = []
for row in reader:
print(row["TOA (ns)"], row["Frecuencia Inicial (MHz)"])
x[i] = row["TOA (ns)"]
y[i] = row["Frecuencia Inicial (MHz)"]
i = i+1
except:
print("Error: ", sys.exc_info()[0])
The exception prints: Error: class 'ValueError'
This are the 2 first lines of my csv, the next line are all float values. I only want TOA and Frecuencia Inicial columns:

Frecuencia Inicialwithout(MHz). This might also be a source for errors. But the exception is thrown somewhere else, as a wrong column name would throw a KeyError. Can you tell the line that's actually throwing the error?x, y = []will try to unpack an empty list into two variables. That raisesValueError: not enough values to unpack (expected 2, got 0)