Read data from csv file

Although unmentioned on Python Mode’s own reference:

Processing’s API got some easier to use CSV methods like loadTable():

Using the Java Mode sketch from this link below as reference:

I did this simplified example which demos how to use loadTable() on Python Mode :

def setup():
    global t
    t = loadTable("data.csv", "header")

    for row in t.rows():
        x = row.getFloat("x")
        y = row.getFloat("y")
        d = row.getFloat("diameter")
        n = row.getString("name")

        print x, y, d, n

    exit()
3 Likes