Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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,389330000 2010, Male, Jacob, 22127,309330000 2011, Female, Sophia, 21842, 311580000 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 in 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 the correct data type (with integers for the first, forth, and fifth elements of the row). 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, None if no file is found at the specified location # YOUR CODE HERE raise Not ImplementedError() # Experimentation cell for students to debug path = 05.path.join(datadir, "namespopie.csv") assert os. path.isfile(pith) columns, dataset - readNames PopLoL(path) print(columns) print(dataset) 11 W Testing cell columns, dataset = readNames PopLoL(os.path.join(datadir,"namespopio.csv")) assert columns - 1 year's 'sex', 'name'. 'count', 'population assert len(dataset) 18 assert isinstance(dataset, list) assert isinstance (dataset (01. list) assert len(dataset (0) 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

What area of performance does the business area want us to measure?

Answered: 1 week ago