subject

Read_data Define a function named read_data with two parameters. The first parameter will be a csv reader object (e. g., the value returned when calling the function csv. reader) and the second parameter will be a list of strings representing the keys for this data. The list matches the order of data in the file, so the second parameter's first entry is the key to use for data in the file's first column, the second parameter's second entry is the key to use for data in the file's second column, and so on. The function's first parameter will be a csv reader object and not a string. This means you do not need the with..as nor create the csv reader in your function, but this will be done in the code calling your function. For example, to execute read_data using a file named ".csv" you would write the following code: with open(".csv") as f_in: csv_r = csv. reader(f_in) result = read_data(csv_r,['tow_date','tow_re ason']) You would then want to include code to check that header had the expected value. The function should return a list of dictionaries. This list will contain a dictionary for each row read using the first parameter. The keys of these dictionaries will be the entries in the second parameter and the values will be the data read in from the file (you can assume there will be equal numbers list entries and columns).
For example, suppose the lines of the file being read by csv_r were:

2015-12-30,IL

2018-04-07,GA

then the call read_data(csv_r,['tow_date','tow_re ason']) would need to return:

[{'tow_date': '2015-12-30', 'tow_reason': 'IL'},
{'tow_date': '2018-04-07', 'tow_reason': 'GA'}]

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
5.a fishing rod is formed from a composite material of 0.5 kg of glass fibers embedded in a matrix of 0.5 kg of epoxy resin. the glass fibers are assumed to be long, continuous and unidirectional. to achieve a greater stiffness it is proposed to use a different composite that is comprised of long continuous carbon fibers that will be embedded in a matrix of 0.5 kg of epoxy resin. if the modulus of elasticity of the carbon fiber composite is 10% greater than the elastic modulus of the glass fiber composite, estimate the mass of carbon fibers that will be used to make the carbon fiber composite. assume the applied tensile stress is parallel to the direction of the long axis of the fibers. the epoxy resin, glass fiber, and carbon fiber have an elastic modulus of 5, 86, and 350 gpa respectively and a density of 1100, 2500, and 1800 respectively.
Answers: 3
question
Computers and Technology, 24.06.2019 21:50
Maddie is traveling to india and would like to document her trip for friends and family to access online. what tool would be best? app blog listserver web page
Answers: 1
You know the right answer?
Read_data Define a function named read_data with two parameters. The first parameter will be a csv r...
Questions
question
Mathematics, 28.04.2021 19:30
question
Mathematics, 28.04.2021 19:30
question
English, 28.04.2021 19:30
question
Mathematics, 28.04.2021 19:30
question
Mathematics, 28.04.2021 19:30
Questions on the website: 13722361