Rather confused with what I'm doing wrong. First CS course and I'm stuck on this part. I need to import the CSV file from excel named "data.csv", but I have zero clue as to why this code is wrong. Thanks for your help. Below is the code.
import csv
path = data.csv
def mean(ch):
A = list()
file = open(path, newline="")
reader1 = csv.reader(file)
next(reader1)
for row in reader1:
A.append(int(row[ch-1]))
return(sum(A)/len(A))
The error is "Unidentified name 'data'"
import csv
path = data.csv
def mean(ch):
A = list()
file = open(path, newline="")
reader1 = csv.reader(file)
next(reader1)
for row in reader1:
A.append(int(row[ch-1]))
return(sum(A)/len(A))
The error is "Unidentified name 'data'"