My Code:
from csv import reader
opened_file = open('googleplaystore.csv' , encoding='utf8')
read_file = reader(opened_file)
googleplaystore = list(opened_file)
googleplaystore_header_str = googleplaystore[0]
googleplaystore_data = list(googleplaystore[1:])
googleplaystore_header = googleplaystore_header_str.split(",")
print(len(googleplaystore_header))
print(googleplaystore_header)
print('\n')
print(len(googleplaystore_data[0]))
print(googleplaystore_data[0])
What I expected to happen:
I would think that the data section would be stored as a list of lists with each row reporting back as a list similar to the header (which is only a list because I added the .split line - was also stored as a string originally)
What actually happened:
Each apps data is stored as a string within the data list. This exercise requires comparing length of each row in the data variable to the header length which is not possible unless it is stored as a list of list. I can’t figure out how to make the data a list of lists.
13
['App', 'Category', 'Rating', 'Reviews', 'Size', 'Installs', 'Type', 'Price', 'Content Rating', 'Genres', 'Last Updated', 'Current Ver', 'Android Ver\n']
150
Photo Editor & Candy Camera & Grid & ScrapBook,ART_AND_DESIGN,4.1,159,19M,"10,000+",Free,0,Everyone,Art & Design,"January 7, 2018",1.0.0,4.0.3 and up