import csv def analyze_iris(): result=[] wortDict={} values=[] with open("Iris.csv", mode='r', encoding='utf-8') as file: reader = csv.reader(file) next(reader, None) # skip the header if present for row in reader: txt=row[5] tmpValues=row[1:5] # slice row array id tmpValues=[float(x) for x in tmpValues] # Convert from string to float array - typecasting values.append(tmpValues) wortDict[txt] = wortDict.get(txt, 0) + 1 rows = len(values) cols = len(values[0]) transposedValues = [[0 for _ in range(rows)] for _ in range(cols)] for i in range(rows): for j in range(cols): transposedValues[j][i] = values[i][j] for i in transposedValues: tmpResult={} tmpResult["max"]=max(i) tmpResult["min"]=min(i) tmpResult["avg"]=round(sum(i)/len(i),2) result.append(tmpResult) result.append(wortDict) #print(transposedValues) print(result) analyze_iris() #print(result) #print("\n".join([str(i) for i in result]))