Screen Link:
My Code:
def extract(index):
column = []
for row in apps_data[1:]:
value = row[11]
column.append(value)
return column
genres = extract(11)
def freq_table(column):
frequency_table = {}
for value in apps_data[1:]:
if value in frequency_table:
frequency_table[value] += 1
else:
frequency_table[value] = 1
return frequency_table
genres_ft = freq_table(genres)
What I expected to happen: the code to run properly and display the extracted genre list
What actually happened: I got a type error and I see where my code went wrong, but I cannot understand why
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-450e02172c55> in <module>
26 return frequency_table
27
---> 28 genres_ft = freq_table(genres)
<ipython-input-1-450e02172c55> in freq_table(column)
20
21 for value in apps_data[1:]:
---> 22 if value in frequency_table:
23 frequency_table[value] += 1
24 else:
TypeError: unhashable type: 'list'
If I can know why “column” is being used to loop through list instead of apps_data ?