I am VERY NEW to programming, and Freshly new to python. I've read in a csv file of two columns and I am looking to find the mean, median, max and min of the second column. I managed to get max and min, but I run into trouble with sum. I'm sure the issue is mostly "syntactic" (is that a word).
with open(pybankfile, newline="") as csvfile:
csv_reader = csv.reader(csvfile, delimiter=",")
# @NOTE: This time, we do not use `next(csv_reader)` because there is no header for this file
# Read the header row first (skip this step if there is now header)
csv_header = next(csvfile)
lst =[]
print(f"CSV Header: {csv_header}")
reader = csv.reader(csvfile)
data = list(reader)
maxnum = max(data, key=lambda row: int(row[1]))
minnum = min(data, key=lambda row: int(row[1]))
tot = sum(data) *#fails here
# print(f"maximum: {maxnum}")
print(data)
sum()
print(f"minimum: {minnum}")
print(f"maximum: {maxnum}")
print(f"Balance: {tot}")