Question: Q3 Write a function readNamesCounts(path) that reads from the file at location path and returns a dictionary with the information from the file. The format
Q3 Write a function readNamesCounts(path) that reads from the file at location path and returns a dictionary with the information from the file. The format of the file is a csv file. The first line is a comma- separated set of string names for the columns contained in the file. In this case, year, name, count. Subsequent lines have, on each line, comma separated values for a data mapping, where the first value gives the independent variable value of the year, and the second and third values on the line give the string name and the Integer count The returned dictionary should map from years to two-tuples consisting of a name and an integer count. Make sure your year keys are integers. Assign to variable temates the dictionary obtained from topfemale.csy and assign to variable mates the dictionary obtained from topmale.csv. Both tiles may be found in the datadir directory YOUR COON OR rakse Not implementediteror) Testing cell assert len males) - 139 assert 1880 in females assert 2011 in female assert females[1300-- "Hary, 7065) assert females 2018) - ma', 18688) assort len males) 139 assert 1880 in males assert 2018 in males assert males[18801 - 'John', 9655) assert males[2018] = ('Liam', 19837)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
