Hi there,
I’m new to Jupyter Notebook and learning with the project about Android and iOS apps. When I want to clean the Android dataset from duplicates, I get the error ‘Index out of range’:
IndexError Traceback (most recent call last)
in
9 already_added.append(name)
10
—> 11 explore_data(android_cleaned, 0, 3, True)in explore_data(dataset, start, end, rows_and_columns)
7 if rows_and_columns:
8 print(‘Number of rows:’, len(dataset))
----> 9 print(‘Number of columns:’, len(dataset[0]))IndexError: list index out of range
I used following code to separate the duplicates:
android_cleaned = []
already_added = [ ]
for app in android:
name = app[0]
n_reviews = float(app[3])
if (reviews_max[name] == n_reviews) and (name not in already_added):
android_cleaned.append(app)
already_added.append(name)
explore_data(android_cleaned, 0, 3, True)
The explore function is as follows:
def explore_data(dataset, start, end, rows_and_columns=False):
dataset_slice = dataset[start:end]
for row in dataset_slice:
print(row)
print('\n')
if rows_and_columns:
print('Number of rows:', len(dataset))
print('Number of columns:', len(dataset[0]))
What am I doing wrong here??
Thanks a lot for your help!