subject

Build_dict(reader) -> dictionary
this function accepts a csv reader as input and returns the required dictionary. it iterates over the csv reader and with each iteration, extracts the needed data and remove any extra whitespaces. you need to skip the header line before start reading the data:

next(reader, none)
the data to be extracted is:

entity - index 0 (string)
records lost - index 2 (int)
year - index 3 (int)
story - index 4 (string)
sector – index 5 (string)
method - index 6 (string)
news sources - index 11 (list of strings)

valid data checks:

if there are multiple news sources at index 11, they will be separated by a comma (‘,’).

these should all be stored in a list. if the news sources field is empty ignore that line.

treat all missing numeric values of "records lost" as a 0. you need to remove all

occurrences of ‘,’ in the records lost before converting to integer. hint: use

.replace()

if any of these pieces of data is missing (other than "records lost"), e. g. the field is empty or spaces, ignore that line of data.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:20
Shown below is the start of a coding region within the fist exon of a gene. 5'--3' 3'--5' how many cas9 pam sequences are present?
Answers: 1
question
Computers and Technology, 22.06.2019 14:20
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
question
Computers and Technology, 23.06.2019 10:00
Whats three fourths of 15(this is supposed to be in math but i clicked too fast)
Answers: 1
You know the right answer?
Build_dict(reader) -> dictionary
this function accepts a csv reader as input and returns t...
Questions
question
Mathematics, 18.05.2021 20:30
Questions on the website: 13722360