Project 1, Step 7 - Errors after Deleting Columns from AppleStore.csv

Screen Link:

My Code:

ios_clean = []
ios_already_added = []

for each_row in ios:
    name = each_row[0]
    n_reviews = float(each_row[3])
    if (n_reviews == reviews_max[name]) and (name not in ios_already_added):

Referring to above

explore_data(ios_clean, 0, 3, True)

What I expected to happen:
although there is no output at this step, I expected to not get an error, and the code in the next line down to produce actual data

What actually happened:
I receive a KeyError and the code appears to stop running

Error 1

KeyError                                  Traceback (most recent call last)
<ipython-input-36-b6edad998821> in <module>
      5     name = each_row[0]
      6     n_reviews = float(each_row[3])
----> 7     if (n_reviews == reviews_max[name]) and (name not in ios_already_added):
      8         ios_clean.append(each_row)
      9         ios_already_added.append(name)

KeyError: '1'

Error 2

IndexError                                Traceback (most recent call last)
<ipython-input-25-e8e33b0c4b67> in <module>
----> 1 explore_data(ios_clean, 0, 3, True)

<ipython-input-2-c983385f4ced> in explore_data(dataset, start, end, rows_and_columns)
     10     if rows_and_columns:
     11         print('Number of rows: ', len(dataset))
---> 12         print('Number of columns: ', len(dataset[0]))
     14 print('Apple Store')

IndexError: list index out of range

What I did to cause this, I think
I ran delete code on the AppleStore.csv first column for the header and data file to remove the original column 0, which is empty on the header and simply a series of index numbers in the data. I did this because the other AppleStore.csv files I see referenced are 16 columns wide and I thought it would be good to match those. I believe this caused the error. The error persists even though I have restarted the kernel and rerun each cell by hand and via menu, after closing and reopening the file.

Any help on this would be greatly appreciated.

Thank you!

I’ve been working through this now since late yesterday afternoon.

I finally looked at the solution file for this section and it looks like it doesn’t contain code to clean ios data they way it does for android in step 10 of the solution file.

Because of this, I had not run the code to build the library for ios, only android. Because of this, my code in the first block is attempting to call the code to build a dictionary using reviews_max, because I didn’t that step (8 in the solution file), I had an index error because there was nothing to reference in reviews_max.

My code runs now without error at these steps.