Question: Q Write a function readNames PopDoL(path) that reads from the CSV file at location path and returns a dictionary of column lists (DOL) representation of

Q Write a function readNames PopDoL(path) that reads from the CSV file at location path and returns a dictionary of column lists (DOL) representation of the data. You can assume that the data is formatted as described above, but your function should work correctly even if the file directory, the file name, or the number of lines in the file were different from the example namespop10.csv file. You should return None if no file is found at the specified location # YOUR CODE HERE raise NotraplementedError # Experimentation cell for students to debug pathos.path.join(datadir,"namespop10.csv") assert os.path.isfile(path) dataset - readNames PopDol(path) print(dataset) # Testing cel? dataset - readNames PopDolos. path.join(datadir, "anespop10.csv")) assert is instance(dataset, dict) for column in tyear', 'sex', 'name', 'count', 'population']: 11: # Testing cell dataset = readNames PopDoL(os.path.join(datadir, "nanespop18.csv")) assert Isinstance(dataset, dict) for column in 'year', 'sex', 'name', 'count', 'population']: assert column in dataset assert len(datasetI'year'l) - 18 assert Isinstance(dataset tyear'), ust) In the tabular data directory (as determined in the final line of the prolog cell) is a file named namespop10.csv . This file conforms to the "simple CSV format" as described in section 3.4.5 of the textbook. A prefix of the file contents is diplayed below: year, sex, name, count, population 2010, Female, Isabella, 22913,309330000 2010, Male, Jacob, 22127,309330000 2011, Female, Sophia, 21842, 311580008 2011, Male, Jacob,20371,311580000 Since this file was exported as a CSV from Google Sheets, each line ends with the two invisibles of a carriage return and a nowline. The latest year in the dataset is 2018. Note that, in terms of data types for any in-memory data structure created, the year, count, and population columns should be integers so that summary information (like min, max, average, etc.) can be calculated from their values Q Write a function readNames PopLoL(path) that reads from the CSV file at location path and returns two items! a list of strings of the column variable names obtained from the first line, a list of row lists (LOL) data structure containing the data obtained from the file. The field values in the row lists should be
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
