I’m struggling with the part of the project where I need to remove duplicates from the data. I have checked the solutions and my code is exactly the same as the code in the solutions but I keep getting a TypeError: unhashable type list. Can anyone help me figure out where my error is?
Here is my code:
reviews_max = {}
android = google_apps_data[1:]
for app in android:
name = app[0]
n_reviews = float(app[3])
if name in reviews_max and reviews_max[name] < n_reviews:
reviews_max[name] = n_reviews
elif name not in reviews_max:
reviews_max[name] = n_reviews
and here is the error:
TypeErrorTraceback (most recent call last)
<ipython-input-42-781b0d53991f> in <module>()
6 n_reviews = float(app[3])
7
----> 8 if name in reviews_max and reviews_max[name] < n_reviews:
9 reviews_max[name] = n_reviews
10
TypeError: unhashable type: 'list'