The code that I still have in the function that basically reads the csv file and prints its contents:
def read(filename): with open(filename, 'r') as csvfile: reader = csv.reader(csvfile, delimiter=',') for row in reader: print(row)
Contents of sailor.csv
:
name, mean performance , std dev Alice, 100, 0, Bob, 100, 5, Clare, 100, 10, Dennis, 90, 0, Eva, 90, 5,
read('sailor.csv')
and running the function
current output:
['name', ' mean performance ', ' std dev'] ['Alice', ' 100', ' 0', ''] ['Bob', ' 100', ' 5', ''] ['Clare', ' 100', ' 10', ''] ['Dennis', ' 90', ' 0', ''] ['Eva', ' 90', ' 5', '']
output required:
{'Dennis': (90.0, 0.0), 'Clare':(100.0, 10.0), 'Eva': (90.0, 5.0), 'Bob': (100.0, 5.0), 'Alice': (100.0, 0.0)}
Any ideas how I can achieve this conclusion? Using Python 3.4.2, if that helps, explain your answer!