Screen Link:
https://app.dataquest.io/m/481/guided-project%3A-building-fast-queries-on-a-csv/5/comparing-the-performance
My Code:
class Inventory():
def __init__(self, csv_filename):
with open(csv_filename) as f:
reader = csv.reader(f)
rows = list(reader)
self.header = rows[0]
self.rows = rows[1:]
for row in self.rows:
row[-1] = int(float(row[-1]))
inventory = Inventory('laptops.csv')
header = inventory.header
print(header,'\n')
print(len(inventory.rows))
What I expected to happen:
[‘Id’, ‘Company’, ‘Product’, ‘TypeName’, ‘Inches’, ‘ScreenResolution’, ‘Cpu’, ‘Ram’, ‘Memory’, ‘Gpu’, ‘OpSys’, ‘Weight’, ‘Price’]
1303
What actually happened:
[’’, ‘Company’, ‘Product’, ‘TypeName’, ‘Inches’, ‘ScreenResolution’, ‘Cpu’, ‘Ram’, ‘Memory’, ‘Gpu’, ‘OpSys’, ‘Weight’, ‘Price_euros’]
1303
Replace this line with the output/error
The id does not display. the excel document I downloaded also had the id section numbered in increasing order, from 1 to 3000+. How can I fix this since it is also affecting the future steps that involve using the id numbers