Graphing data live from CSV file Graphing data live from CSV file tkinter tkinter

Graphing data live from CSV file


I believe your issue lies here:

if len(line) > 1:    line.split(" ")    x, y = line.split(',') # specifically this line.    xs.append(x)    ys.append(y)

The x, y = split(',') could work if you were working with only one comma per line because you would create a 2 index list and each would assign to x and y but anything bigger would not work here.

Update:

Here is a better option to work with the format of your CSV.

First we need to rstrip() the line. What this will do is remove the \n from the line. This will help later.

Next we need to do split(",") to create our list. This list will have 3 index points. The first value from column B the empty string from column C and the 2nd value form column D. Then you can assign the index to each of your other list.

def animate():    xs = []    ys = []    with open('flashDump.csv') as graph_data:        for line in graph_data:            rstriped = line.rstrip()            if len(rstriped) > 1:                line_list = rstriped.split(",")                xs.append(line_list[0])                ys.append(line_list[2])                print(xs, ys)animate()