Build_dict(reader) -> dictionary
this function accepts a csv reader as input and returns t...
Computers and Technology, 17.12.2019 04:31, chameleonsarelife
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.
Answers: 1
Computers and Technology, 22.06.2019 00:00, ajwiebel3475
Which requirement is an appropriate reason for a business to use it tools
Answers: 3
Computers and Technology, 22.06.2019 13:30, morganwendel126
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
Mathematics, 12.02.2021 19:40
Mathematics, 12.02.2021 19:40
Mathematics, 12.02.2021 19:40
Mathematics, 12.02.2021 19:40