Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Accesses the data stored in the file_data instance variable (a list) and converts it to a dictionary, data_dict, where each key is a column name

Accesses the data stored in the file_data instance variable (a list) and converts it to a dictionary, data_dict, where each key is a column name found in the CSV, and each value is a list of data in that column with the same order as it was in the file. Each element of the list corresponds to a single row in the CSV. For example, to access the Title column in the CSV, I would access data_dict[Title].image text in transcribed^^^ this is the csv filed.

This is the code I have now (IN PYTHON). My error is that the list index is out of range and I have tried many things and not get how to fix this issue. The cvs has already been opened and read before this.

self.data_dict = {

'Title': [],

'Pages': [],

'URL': [],

'Author Name': [],

'Genre': [],

}

for i in range(len(self.file_data) + 1):

self.data_dict['Title'].append([i][0])

self.data_dict['Pages'].append([i][1])

self.data_dict['URL'].append([i][2])

self.data_dict['Author Name'].append([i][3])

self.data_dict['Genre'].append([i][-1])

1 2 3 4 5 6 7 8 9 10 11 12 13 Title, Pages, URL, Author Name, Genre The Book Thief,552, https://www.goodreads.com/book/show/19063, Markus Zusak, Historical Fiction The Hunger Games,374, https://www.goodreads.com/book/show/2767052, Suzanne Collins, Science Fiction Romeo and Juliet, 301, https://www.goodreads.com/book/show/18135, William Shakespeare, Romance To Kill a Mockingbird, 324, https://www.goodreads.com/book/show/2657, Harper Lee, Historical Fiction Pride and Prejudice, 279, https://www.goodreads.com/book/show/1885, Jane Austen, Historical Fiction Twilight, 501, https://www.goodreads.com/book/show/41865, Stephenie Meyer, Fantasy Animal Farm, 141, https://www.goodreads.com/book/show/170448, George Orwell, Science Fiction The Chronicles of Narnia, 767, https://www.goodreads.com/book/show/11127,C.S. Lewis, Fantasy The Fault in Our Stars, 313, https://www.goodreads.com/book/show/11870085, John Green, Romance Gone with the Wind, 1037, https://www.goodreads.com/book/show/18405, Margaret Mitchell, Historical Fiction The Alchemist, 182, https://www.goodreads.com/book/show/18144590, Paulo Coelho, Philosophy The Da Vinci Code, 489, https://www.goodreads.com/book/show/968, Dan Brown, Mystery Thriller The Picture of Dorian Gray, 272, https://www.goodreads.com/book/show/5297, Oscar Wilde, Horror Memoirs of a Geisha,503, https://www.goodreads.com/book/show/929, Arthur Golden, Historical Fiction Fahrenheit 451,194, https://www.goodreads.com/book/show/13079982, Ray Bradbury, Science Fiction Lord of the Flies, 182, https://www.goodreads.com/book/show/7624, William Golding, Science Fiction 14 15 16 17

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

Students also viewed these Databases questions

Question

3. In your description answer the following questions:

Answered: 1 week ago