Building fast querie

Screen Link:

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

What I expected to happen:

[‘Id’, ‘Company’, ‘Product’, ‘TypeName’, ‘Inches’, ‘ScreenResolution’, ‘Cpu’, ‘Ram’, ‘Memory’, ‘Gpu’, ‘OpSys’, ‘Weight’, ‘Price’]

What actually happened:
[’’, ‘Company’, ‘Product’, ‘TypeName’, ‘Inches’, ‘ScreenResolution’, ‘Cpu’, ‘Ram’, ‘Memory’, ‘Gpu’, ‘OpSys’, ‘Weight’, ‘Price_euros’]


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

Did you download the file from the Kaggle link or did you download the dataset that DQ provides. Because as they mention -

We will use the laptops.csv file as our inventory. This CSV file was adapted from the Laptop Prices dataset on Kaggle. We changed the IDs and made the prices integers.

It seems you download the one from Kaggle which does not have a name for the first column. That’s why in your output you see -

It’s blank because it has no name in the original dataset on Kaggle.

You need to download the csv file that DQ provides. You can do that by clicking on the Download button at the top of the Jupyter Notebook in the Classroom.

Thank you for your input. The only link provided takes me to Kaggle and that’s where I downloaded the file. The same thing happened in my first python project as well. ID was missing. how do I get the correct file?

I pointed that out in my previous reply.

It is downloading a zip file that requested for password. I put in the wrong password because I login to DQ using my google account so no password setup. Can I get a link that just takes me to the file download instead?

That’s weird. It should not be asking for any passwords at all. That’s something you should contact their support for. There is a Contact Us button on the top-right side of this page that you can use to ask them about this.

Thank you for your input. The ‘contact us’ button is broken and not going through. I will try again tomorrow.

Here is a screenshot of the zip file after trying to download it.

1 Like

It may be due to some addons of your browser. Please try to open it in Incognito or Private mode and then try again.