Index out of bounds?

Getting index out of bounds error. Tried checking the thread in the link given, but still unsure. Appreciate any feedback.

### Google Play data set ### 
opened_file = open('googleplaystore.csv')
from csv import reader
read_file = reader(open_up)
android = list(read_file)
android_header = android[0]
android = android[1:]

### App Store data set ###
opened_file = open('AppleStore.csv')
reade_file = reader(opened_file)
ios = list(read_file)
ios_header =ios[0]
ios = ios[2:]

def explore_data(dataset, start, end, rows_and_columns=False):
    dataset_slice = dataset[start:end]    
    for row in dataset_slice:
        print(row)
        print('\n') # adds a new (empty) line after each row

    if rows_and_columns:
        print('Number of rows:', len(dataset))
        print('Number of columns:', len(dataset[0]))

print(android_header)
print('\n')
explore_data(android, 0, 3, True)

When I tried running your code I got errors from these 2 spots:

opened_file = open('googleplaystore.csv')
from csv import reader
read_file = reader(open_up)         #should be reader(opened_file)
reade_file = reader(opened_file)         #should be read_file
ios = list(read_file)

When I fixed these 2 typos the code seemed to work okay.

1 Like

Ah, thanks! I see it now. Took another pair of eyes.

1 Like